GridBagSizer in GroupBox: Sizes calculated right but drawn wrong

Dear list,
WinXP, Python 2.3.4, wx2.5.2.8u:
I have a question about groupBoxSizers. Please refer the sample code
attached.
The matter is: they calculate right but show up false. I put a GridBagSizer
into a GroupBoxSizer, which are then centered on a notebook panel by two
BoxSizers (horizontal and vertical). As you can see, the sizes for the
GroupBoxSizer are calculated right (slightly greater than the GridBagSizer's
extensions), but what you can actually see of it does not match the
calculated sizes.
How can I accomplish the GroupBox to always surround all items of the
GridBagSizer, even if it's items exceed the panels size?
Thanx in advance for your help!!
Best regards
Oliver

gbstest.py (1.54 KB)

Oliver Walczak wrote:

Dear list,
WinXP, Python 2.3.4, wx2.5.2.8u:
I have a question about groupBoxSizers. Please refer the sample code
attached.
The matter is: they calculate right but show up false. I put a GridBagSizer
into a GroupBoxSizer, which are then centered on a notebook panel by two
BoxSizers (horizontal and vertical). As you can see, the sizes for the
GroupBoxSizer are calculated right (slightly greater than the GridBagSizer's
extensions), but what you can actually see of it does not match the
calculated sizes.
How can I accomplish the GroupBox to always surround all items of the
GridBagSizer, even if it's items exceed the panels size?

The static box is doing what the sizer tells it to do, but since there are empty spaces around it that are forced to have a proportional share of the free space it is getting squeezed smaller than it wants to be. Since the contents of the GridBagSizer is on the same panel it is not getting tuncated where it overflows.

One way to resolve this is to ensure that the frame is not allowed to get smaller than what the sizers need for their minimal layout. You can do that in your sample by adding this to the __main__ section before Show()ing the frame:

     sizer = wx.BoxSizer()
     sizer.Add(nb, 1, wx.EXPAND)
     frm.SetSizer(sizer)
     sizer.SetSizeHints(frm)

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!