[wxPython-users] Problem with wx.SplitterWindow...

Robin Dunn robin at alldunn.com
Wed May 9 12:56:20 PDT 2007


Stefan Holmgren wrote:
> Hi,
> I have a problem with wx.SplitterWindow (see attached py-file)
> 
> I use a splitter window with 2 panels...
> At startup the splitter window is unsplit and then I split/unsplit the 
> window manually.
> I want to have a second panel, when the window is split, in fixed size:
>         self.splitt.SetMinimumPaneSize(20)
>         self.splitt.SetSashGravity(1.0)
>         self.splitt.SplitHorizontally(self.panel1, self.panel2, -50)
> 
> When I split the first time and maximize the window the sash is not in 
> correct position.
> But, if I unsplit and split again and then maximize, it's working as 
> excepted.
> Or if I resize the window by grabbing the frame before maximize, it's also 
> working.
> 
> Am I doing something wrong when I split/unsplit the frame, or is this a bug 
> in wx.

Maybe, but it is an easy one to workaround.  The splitter does some 
internal housekeeping in its EVT_SIZE handler.  Since there isn't a size 
event between the time that you do the split and when it gets maximized, 
then that housekeeping isn't done until after the maximize takes place, 
after it has already resized the lower pane.  So if you add this after 
doing your split then it will work as you expect:

         self.splitt.SendSizeEvent()

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





More information about the wxpython-users mailing list