Trouble with ListBoxes in wxPyhton

Vivienne velzev at
Fri Jun 11 16:36:36 CEST 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)

class PList:
    def __init__(self, panel):
        self.lijst = ['bla','bla','bla']
        self.panel = panel = 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
class CList:
    def __init__#etc.

    def EmptyList(self):

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)

But 1. This isn't working, and 2. It seems to be a very roundabout way.
Could anyone please help me?


More information about the Python-list mailing list