I’m having a problem creating a GUI. I’m trying to bind an event to a
button but when i bind the event, the callback is called immediately.
I’m not sure what the heck is happening. Any help would be greatly
appreciated. if you look at the code below you can see that the
callback is getting called immediately.
def _create_Gui (self, vbox): self.myform = myform = form.form() hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add((5,0),0) self.b1 = wx.ToggleButton(self.panel,wx.ID_ANY,"button 1") print "1" self.b1.Bind(wx.EVT_LEFT_DCLICK, self._setText()) print "2" hbox.Add(self.b1,1,wx.LEFT | wx.RIGHT ,2) self.b2 = wx.Button(self.panel,wx.ID_ANY,"button 2") hbox.Add(self.b2,1,wx.LEFT | wx.RIGHT ,2) vbox.Add(hbox, 0, wx.EXPAND) return def _setText(self): print "button pressed" self.b1.Show(False) return
Terminal Window Output