setattr what is the parent object?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Mar 25 16:08:09 EDT 2008


En Tue, 25 Mar 2008 15:46:57 -0300, Jules Stevenson <lists at js3d.co.uk>  
escribió:

> 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 __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?

You don't have to save the sizer anywhere, but you have to call  
container.SetSizer(the_sizer)

-- 
Gabriel Genellina




More information about the Python-list mailing list