Problem with controls mass production

The gist of my BuildButton follows:

def BuildButton(self, label, eventhandler, pos, Variable = ‘notgiven’):

    bt = wx.Button(self.panel, -1, bmp, name = name)
    else:

        bt = buttons.GenBitmapTextToggleButton(self.panel, -1, label = label, \
        pos = pos)
    if not eventhandler is None:
        self.Bind(wx.EVT_BUTTON, eventhandler, bt)
    if Variable != 'notgiven': Variable = bt

return bt

Every thing works but the assignment of bt to Variable: Variable was and remains None (or whatever value I gave it when I first declared it)

···

2008/7/10 Josh English joshua.r.english@gmail.com:

I’m not clear on the role of each tuple in your list, but I think

you’re aiming for :

buttonList = [(wx.ID_EXIT,pos,self.OnClose),…] # ID, position, callback

for button in buttonList:

id, pos, callback = button

bt = wx.Button(self,id=id,position=pos)

bt.Bind(callback)

The disadvantage is you don’t have an easy way to get these buttons

back unless you give the buttons names and search for them (whcih I’m

not sure a window can do).

What does your BuildButton method look like?

Josh English

Joshua.R.English@gmail.com

http://joshenglish.livejournal.com


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users