title: wxpython: How do you access the objects which you've placed inside of a wx.Sizer object?
body: <p>During a refactoring session, I put a lot of my gui code into little functions which directly inserts data into a wx.Sizer object.</p>
  
  <p>For instance, this little function:</p>
  
  <pre><code>def buildStatusDisplay(self, status_disp, flag):
      grid = wx.FlexGridSizer(cols=1, hgap=5, vgap=0)
      font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.LIGHT, False, 'Segoe UI')
      for option in status_disp:
          left = wx.StaticText(self, -1, option)
          left.SetFont(font)
          grid.Add(left, 0, flag=flag)
      return grid
  </code></pre>
  
  <p>So it creates all of the StaticText objects using the throwaway <code>left</code>, and then returns the <code>FlexGrid</code>. However, I need some of the labels in the StaticText objects to update based on user input, but, I'm not sure how to access them. </p>
  
  <p>I've looped through the sizer that gets returned from the function, but I don't see anything relating to a way that would let me get reference to the objects which make up the sizer. </p>
  
  <pre><code>for i in dir(sizer):
      print i 
  
  &gt;&gt;Add
  &gt;&gt;AddF
  &gt;&gt;AddGrowableCol
  &gt;&gt;AddGrowableRow
  &gt;&gt;AddItem
  &gt;&gt;AddMany
  &gt;&gt;AddSizer
  &gt;&gt;AddSpacer
  &gt;&gt;AddStretchSpacer
  &gt;&gt;AddWindow
  &gt;&gt;CalcMin
  &gt;&gt;CalcRowsCols
  &gt;&gt;Children
  &gt;&gt;ClassName
  &gt;&gt;Clear
  &gt;&gt;ColWidths
  &gt;&gt;Cols
  &gt;&gt;ComputeFittingCli
  &gt;&gt;ComputeFittingWin
  &gt;&gt;ContainingWindow
  &gt;&gt;DeleteWindows
  &gt;&gt;Destroy
  &gt;&gt;Detach
  &gt;&gt;Fit
  &gt;&gt;FitInside
  &gt;&gt;FlexibleDirection
  &gt;&gt;GetChildren
  &gt;&gt;GetClassName
  &gt;&gt;GetColWidths
  &gt;&gt;GetCols
  &gt;&gt;GetContainingWind
  &gt;&gt;GetFlexibleDirect
  &gt;&gt;GetHGap
  &gt;&gt;GetItem
  &gt;&gt;GetItemIndex
  &gt;&gt;GetMinSize
  &gt;&gt;GetMinSizeTuple
  &gt;&gt;GetNonFlexibleGro
  &gt;&gt;GetPosition
  &gt;&gt;GetPositionTuple
  &gt;&gt;GetRowHeights
  &gt;&gt;GetRows
  &gt;&gt;GetSize
  &gt;&gt;GetSizeTuple
  &gt;&gt;GetVGap
  &gt;&gt;HGap
  &gt;&gt;Hide
  &gt;&gt;Insert
  &gt;&gt;InsertF
  &gt;&gt;InsertItem
  &gt;&gt;InsertSizer
  &gt;&gt;InsertSpacer
  &gt;&gt;InsertStretchSpac
  &gt;&gt;InsertWindow
  &gt;&gt;IsSameAs
  &gt;&gt;IsShown
  &gt;&gt;Layout
  &gt;&gt;MinSize
  &gt;&gt;NonFlexibleGrowMo
  &gt;&gt;Position
  &gt;&gt;Prepend
  &gt;&gt;PrependF
  &gt;&gt;PrependItem
  &gt;&gt;PrependSizer
  &gt;&gt;PrependSpacer
  &gt;&gt;PrependStretchSpa
  &gt;&gt;PrependWindow
  &gt;&gt;RecalcSizes
  &gt;&gt;Remove
  &gt;&gt;RemoveGrowableCol
  &gt;&gt;RemoveGrowableRow
  &gt;&gt;RemovePos
  &gt;&gt;RemoveSizer
  &gt;&gt;RemoveWindow
  &gt;&gt;Replace
  &gt;&gt;RowHeights
  &gt;&gt;Rows
  &gt;&gt;SetCols
  &gt;&gt;SetContainingWind
  &gt;&gt;SetDimension
  &gt;&gt;SetFlexibleDirect
  &gt;&gt;SetHGap
  &gt;&gt;SetItemMinSize
  &gt;&gt;SetMinSize
  &gt;&gt;SetNonFlexibleGro
  &gt;&gt;SetRows
  &gt;&gt;SetSizeHints
  &gt;&gt;SetVGap
  &gt;&gt;SetVirtualSizeHin
  &gt;&gt;Show
  &gt;&gt;ShowItems
  &gt;&gt;Size
  &gt;&gt;VGap
  &gt;&gt;_ReplaceItem
  &gt;&gt;_ReplaceSizer
  &gt;&gt;_ReplaceWin
  &gt;&gt;_SetItemMinSize
  &gt;&gt;__class__
  &gt;&gt;__del__
  &gt;&gt;__delattr__
  &gt;&gt;__dict__
  &gt;&gt;__doc__
  &gt;&gt;__format__
  &gt;&gt;__getattribute__
  &gt;&gt;__hash__
  &gt;&gt;__init__
  &gt;&gt;__module__
  &gt;&gt;__new__
  &gt;&gt;__reduce__
  &gt;&gt;__reduce_ex__
  &gt;&gt;__repr__
  &gt;&gt;__setattr__
  &gt;&gt;__sizeof__
  &gt;&gt;__str__
  &gt;&gt;__subclasshook__
  &gt;&gt;__swig_destroy__
  &gt;&gt;__weakref__
  &gt;&gt;_setOORInfo
  </code></pre>
  
  <p><code>GetChildren()</code> returns only <code>SizerItems</code> which don't seem to hold any reference to the underlying objects either. </p>
  
  <p>Anyone know how to access something inside of a sizer? I suppose I could just explode the function a bit and either return a list of the objects as well as the sizer, or simple dump the function and keep identifiers to the objects I need to modify in main.. but... my gui code is already spaghetti enough. If I can avoid it, I would like to. </p>