[wxPython-users] boxsizers problem

Robin Dunn robin at alldunn.com
Mon Sep 11 12:37:32 PDT 2006


Moritz Tacke wrote:
> Hi!
> 
> I am running into a dead end while trying to combine several widgets
> containing their own sizers into sizers of higher-level widgets.
> 
> Precisely: I have a topwidget, inherited from wx.Frame, which
> contains two subwidgets. One of these widgets is a wx.Window, the
> other one is a widget inherited from wx.Window, which intself contains two
> wx.Windows. The latter two wx.Windows are placed by a wx.BoxSizer, as
> well as the two medium-level widgets are within the toplevel widget.
> 
> This doesn't work: the lowest-level widgets are stacked on top of each
> other. What is my mistake?

wx.Window doesn't automatically use it's sizer like other widget types 
such as wx.Panel will.  There are several reasons for this which I won't 
go into now, but you can fix this either by giving your 
wx.Window-derived classes a EVT_SIZE handler that calls self.Layout, or 
just use a wx.Panel instead of wx.Window.



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





More information about the wxpython-users mailing list