title: wxPython - problem with nested sizers, a panel and SetSizer / Fit
body: <p>I am currently trying to get a grip on wxPython, and I stumbeled over nesting sizers, putting them on a panel and fit them.</p>
  
  <p>I want to have a GridBagSizer in a StaticBoxSizer in a BoxSizer. The whole should be on a panel.</p>
  
  <p>My code:</p>
  
  <pre><code>import wx
  
  class App(wx.Frame):
      def __init__(self):
          wx.Frame.__init__(self, None, -1, "Frame", size=(550, 300))
          panel = wx.Panel(self, -1)
          mainSizer = self.makeOuterSizer()
  
          # fit layout
          panel.SetSizer(mainSizer)
          mainSizer.Fit(panel)
  
  ##         mainSizer.Fit(self)
  ##         self.SetSizer(mainSizer)
  
      # ----
  
      def makeOuterSizer(self):
  
          # define sizer
          innerSizer = self.makeGrid()
  
          # make 
          outerSizer = wx.BoxSizer(wx.VERTICAL)
          outerSizer.Add(innerSizer, 0, wx.EXPAND|wx.CENTER|wx.ALL, 10)
  
          return outerSizer
      # ----
  
      def makeGrid(self):
  
          sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, ""), wx.VERTICAL)
  
          # make fields
          itemMonomer1_label = wx.StaticText(self, -1, "Text 1")
          self.itemMonomer1_value = wx.TextCtrl(self, -1, "", size=(100, -1))
          itemMonomer2_label = wx.StaticText(self, -1, "Text 2")
          self.itemMonomer2_value = wx.TextCtrl(self, -1, "", size=(100, -1))
          itemMonomer3_label = wx.StaticText(self, -1, "Text 3")
          self.itemMonomer3_value = wx.TextCtrl(self, -1, "", size=(100, -1))
  
          # pack elements
  
          grid = wx.GridBagSizer(2, 3)
  
          grid.Add(itemMonomer1_label, (0,0), flag=wx.ALIGN_CENTER|wx.ALIGN_CENTER_VERTICAL)
          grid.Add(self.itemMonomer1_value, (1,0), flag=wx.EXPAND)
          grid.Add(itemMonomer2_label, (0,1), flag=wx.ALIGN_CENTER|wx.ALIGN_CENTER_VERTICAL)
          grid.Add(self.itemMonomer2_value, (1,1), flag=wx.EXPAND)
          grid.Add(itemMonomer3_label, (0,2), flag=wx.ALIGN_CENTER|wx.ALIGN_CENTER_VERTICAL)
          grid.Add(self.itemMonomer3_value, (1,2), flag=wx.EXPAND)
  
          sizer.Add(grid, 0, wx.EXPAND|wx.ALIGN_CENTER|wx.ALL, 5)
  
          return sizer
      # ----
  
  if __name__ == '__main__':
      app = wx.App()
      App().Show(True)
      app.MainLoop()
  </code></pre>
  
  <p>So, the code above does not really work. However, when I quote lines 10 and 11, and unquote lines 13 and 14, at least the GridBagSizer is correctly shown. So I suspect that something in my SetSizer and Fit lines must be wrong... But the panel is still stuck in the upper right corner and does not work...</p>
  
  <p>Any hint is much apprechiated!</p>
  
  <p>Thanks, Woodpicker</p>