开发者

Shuttle control in wxPython

I'm trying to implement a shuttle control in wxPython but there doesn't seem to be one. I've decided to use two listbox controls. The shuttle control looks like this:

alt text http://knol.google.com/k/-/-/153594c开发者_如何学Python4goidl/p559ta/picture-52.png

I've got two listboxes — one's populated, one's not. Could someone show me how to add a selected item to the second list box when it is double clicked? It should be removed from the first. When it is double clicked in the second, it should be added to the first and removed from the second. The shuttle control implements these by default but it's a pity it isn't there.

Thank you.


i don't know what a shuttle control is exactly, maybe for videos? maybe this will help

# in your init method
self.Bind(wx.EVT_LISTBOX_DCLICK, self.EvtListBoxDClick, self.mainlist)


# the callback
def EvtListBoxDClick(self, event):
     self.otherlist.Append(self.mainlist.GetSelection())
     self.mainlist.Delete(self.lb1.GetSelection())

Take a look at the WxPython example file included with the distribution (ListBox.py)

Cheers

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜