[wxPython-users] FlexGridSizer not resizing custom control
Robin Dunn
robin at alldunn.com
Thu Dec 7 15:43:34 PST 2006
Jeffrey Barish wrote:
> I am trying to create a custom control that simply draws a stretchable
> horizontal line. When I put the control in a horizontal BoxSizer, the line
> stretches when the window resizes to fill the space available, as it
> should. When I put the control in a growable column of a FlexGridSizer,
> the line does not stretch. I'm probably doing something wrong with the
> FlexGridSizer, which I have never used before, but maybe I've done
> something wrong in the custom control even though it works correctly with
> the BoxSizer. With the FlexGridSizer, the growable column grows as it
> should, but the ClientSize for the custom control does not change. The
> ClientSize does change when I use the control with the BoxSizer.
>
You need to tell the sizer that you want the item to expand to fill the
space it is given. With the box sizer you used a proportion=1, which
means that the item should share all extra space in the same direction
that the sizer is (wx.HORIZONTAL in this case) with any other
proportional items. The grid sizers don't use the proportions
currently, but you can tell it to fully expand the item using the flags
parameter.
sizer.Add(StretchLine(self), 0, wx.EXPAND)
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list