I'm doing a little wxPython work today and I've got this piece of code (I've stripped out the irrelevant parts):
def CreateRowOne(self, pan):
hbox1 = wx.BoxSizer(wx.HORIZONTAL)
hbox1.Add(wx.Button(pan, -1, "250 Words"), 1, wx.EXPAND | wx.ALL)
hbox1.Add(wx.Button(pan, -1, "500 Words"), 1, wx.EXPAND | wx.ALL)
hbox1.Add(wx.Button(pan, -1, "750 Words"), 1, wx.EXPAND | wx.ALL)
return hbox1
How do you get the ID of the buttons that were created, so I can bind them to a handler? Normally, I'd do this:
button1 = wx.Button(...)
button2 = wx.Button(...)
...
self.Bind(wx.EVT_BUTTON, self.Blah, button1.GetID())
self.Bind(wx.EVT_BUTTON, self.Blah2, button2.GetID())
but I didn't give an identifier to any of the buttons. Am I going to have to manually assign the ID numbers?