setattr what is the parent object?

Jules Stevenson lists at js3d.co.uk
Tue Mar 25 14:46:57 EDT 2008


I'm trying to use setattr to dynamically name and layout gui wx widgets,
this is all fine and dandy until I've run up against something where I
simply don't know what the object is, please see the amended **don't know**
in the following code.

 

class MyFrame2(wx.Frame):

    def __init__(self, *args, **kwds):

      blah blah blah

      __do_layout(mayaVars)

 

    def __do_layout(self, mayaVars):

            main_boxSizer = wx.BoxSizer(wx.VERTICAL)

            for pDisplay in range(len(mayaVars.primary)):

                setattr=(**don't
know**,"r_gridBagSizer_"+mayaVars.primary[pDisplay], wx.GridBagSizer(vgap=0,
hgap=0))

              

Without all the dynamic gumpf, the statmement looks like this:

 

r_gridBagSizer = wx.GridBagSizer(vgap=0, hgap=0))

  

All the other UI elements are created on 'self' but the sizers don't seem to
'belong' to anything - what should I use when this is the case? 

 

Many thanks, and apologies if I'm being dense

 

Jules

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080325/3b32a129/attachment.html>


More information about the Python-list mailing list