Question : [wxPython] Combo Boxes and EVT_COMBOBOX

I'm trying to work with a combo box event, but the event itself doesn't seem to be called at all. Here's my code:

        self.DiffLight = wxComboBox(self,-1,'1',wxDLG_PNT(self,18,112),wxDLG_SZE(self,20,-1),choices=['1','2','3','4','5','6','7','8','9'],style=wxCB_DROPDOWN)

        EVT_COMBOBOX(self,ID_DIFFL,self.SetLight)

    def SetLight(self,event):
        print 'self.SetLight()'

SetLight isn't called at all, but there are no errors and the combo box displays and works fine (same for two other combo boxes). What did I miss?

Answer : [wxPython] Combo Boxes and EVT_COMBOBOX

You're giving your combobox an ID of -1, but you're passing ID_DIFFL to EVT_COMBOBOX - you need to pass ID_DIFFL to wxComboBox as well.
Random Solutions  
 
programming4us programming4us