I am working on a wxpython GUI. I have three panels (two on the left split horizontally and one on the right split vertically from the other two — think two squares on left half and tall rectangle on right half). I am trying to fit a Gridsizer in Panel 3 (P3 in image). I cannot seem to get the grid panels to “fill” the overall Panel 3. Instead they snap to the top and bottom. Ideally, i would like the 10 small panels (2 rows, 5 cols) to resize and fill the Panel 3 nicely (all the same size and big enough to see each). What am I doing wrong? Thanks!
**** EDIT ****
I have changed my code to look like the following:
sizer_31 = wx.BoxSizer(wx.VERTICAL)
gs = wx.GridSizer(0,4,7,7)
for i in self.Panel_Others.keys():
gs.Add(self.Panel_Others[i],0,wx.ALIGN_CENTER|wx.ALL,5)
sizer_31.Add(gs,0,wx.ALIGN_CENTER|wx.ALL,5)
self.OtherTeams.SetSizer(sizer_31)
sizer_31.SetSizeHints(self.OtherTeams)
And my New Panel 3 looks like the picture below. This is some improvement. However, I want the individual panels (10 in all) to expand the same amount so that the entire notebook page is covered in equal size smaller panels (Imagine what a Calendar looks like and each day is a panel).

**** END EDIT ****
Below is my original code:
Note: self.OtherTeams is the wx.Notebook Page under self.Panel3. self.Panel_Others is a dictionary containing the wx.Panels I’m displaying (this changes dynamically so this is why i have a dictionary of them rather than specifying them).
sizer_31 = wx.BoxSizer(wx.HORIZONTAL)
gs = wx.GridSizer(2,5,5,5)
for i in self.Panel_Others.keys():
sizer_temp = wx.BoxSizer(wx.VERTICAL)
sizer_temp.Add(self.Panel_Others[i],1,wx.EXPAND)
gs.Add(sizer_temp,1,wx.EXPAND,0)
sizer_31.Add(gs,0,wx.EXPAND)
self.OtherTeams.SetSizer(sizer_31)

In
wxPython 2.8this would result in a single blur at the top left corner of the page.wxPython 2.9is a bit smarter when it comes to sizers which is why it appears to work somewhat.Firstly, you create a
GridSizerwithin aBoxSizerbut you do not allow it to expand dynamically (wx.EXPAND).And secondly, you’re setting the sizer to the
wx.Notebookinstead of the page (panel) which would shift the entire layout down and crop the bottom row of controls/panels in the grid sizer, or would be ignored entirely in2.8thus moving everything to the top left corner.This should do the trick:
EDIT: The following example demonstrates how to dynamically update the contents of a wx.GridSizer in a wx.Notebook page: