[wxPython-users] Sizers and a SplitterWindow

Christopher Barker Chris.Barker at noaa.gov
Mon Jul 9 14:21:17 PDT 2007


J.A. de Vries wrote:
> Now I
> want to do the same automatic resizing for both panels of the
> SplitterWindow when the sash is moved, or when the Frame is resized.
> Something is probably escaping me though, because I have not managed to
> do that yet. 
> 
> Could someone describe the concept for me? 

I think what may be confusing you is the multiple hierarchies of wx:

The hierarchy of Sizers, the hierarchy of wxWindows and the Hierarchy of 
python classes. These are each independent.

In your case:

Each side of a splitter Window can contain a wx.Window. You probably 
want to put a wx.Panel in each side. a wx.Panel is a wx.Window that is 
designed to have another wx.Windows (controls, etc.) put on it.

You then can use a hierarchy of Sizers to put your controls on the Panels.

 > I tried adding the controls
 > placed in both panels to their own sizer and adding those to the sizer
 > containing the SplitterWindow as a whole,

You don't want to split sizers across layers like that. There is a Sizer 
laying out the splitter -- the splitter holds two wx.Panels. Each of 
those panels should have one and only one Sizer set on it, but that 
sizer can contain other sizers.

Now for the Python class hierarchy:

You probably want a subclass of wx.Panel for the right side of your main 
Frame. It will hold the various controls you need, and have methods the 
change what is being displayed there

Hope that helped...

If not, post as small a sample as you can, as close to doing what you 
want as possible, and we'll take a look and make suggestions.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the wxpython-users mailing list