Trouble with ListBoxes in wxPyhton
Vivienne
velzev at freemail.nl
Fri Jun 11 10:36:36 EDT 1999
Hi there,
I'm new to wxPython and I'm having some difficulties with Listboxes. I
create a panel with two listboxes that are filled with strings. When I
select an item from one listbox, the other should go empty (eventually there
should appear a list of objects that are linked to the chosen item). At the
moment I try it like this :
def UpdateCList(self, panel):
x = CList(panel)
x.EmptyList()
class PList:
def __init__(self, panel):
self.lijst = ['bla','bla','bla']
self.panel = panel
self.box = wxListBox(panel, 10, wxPoint(100,100), wxDefaultSize,
self.lijst, wxLB_SINGLE|wxLB_SORT)
EVT_LISTBOX(panel, 10, self.OnLeftClick)
def OnLeftClick(self, event):
#some code
UpdateCList(self, self.panel)
#class CList has a similar implementation, with the following method
included:
class CList:
def __init__#etc.
def EmptyList(self):
self.box.Clear()
class MyApp(wxApp):
def OnInit(self):
frame = wxFrame(NULL,-1,'Test')
panel = wxPanel(frame, -1)
x = CList(panel)
y = PList(panel)
if __name__=='__main__':
app = MyApp(0)
app.MainLoop()
But 1. This isn't working, and 2. It seems to be a very roundabout way.
Could anyone please help me?
Thanks,
Vivienne
More information about the Python-list
mailing list