[wxPython] wxSplitterWindow and sizing

I'm having trouble setting the initial sash position of a wxSplitterWindow. I
want the splitter window to start out split into two panes with the same
height, which I should be able to do by setting the sash position argument of
SplitHorizontally to zero.

The wxSplitterWindow is in a panel, together with a number of other controls.
I'm using a vertical wxBoxSizer to divide up the panel client area. I give
fixed heights to the rest of the controls, and allow the splitter window to
stretch to take up the rest of the room.

The problem is that the box sizer seems initially to assign a height of 20
pixels to the splitter window. Thus, if I call splitter.SplitHorizontally in
the panel's __init__ method, it gives 10 pixels to each panel. Then, when the
frame containing the panel is shown, the box sizer increases the size of the
the splitter, but the default resizing behavior of the splitter window is to
leave the height of the first pane unchanged and stretch the second pane,
leaving them unequal.

My current work around for this problem is to define an InitShow method for
the panel which calls splitter.SplitHorizontally. Then, I make the OnInit
method of the application class call frame.panel.InitShow immediately after
calling frame.Show.

Is there a better way to do this? In particular, is there an event which is
always triggered after the window is shown, so that I don't have to add
frame.panel.InitShow manually to my application class's OnInit?

David Fox

···

____________________________________________________________________
Get your own FREE, personal Netscape WebMail account today at http://home.netscape.com/webmail
_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users

The problem is that the box sizer seems initially to assign a height of 20
pixels to the splitter window. Thus, if I call splitter.SplitHorizontally

in

the panel's __init__ method, it gives 10 pixels to each panel. Then, when

the

frame containing the panel is shown, the box sizer increases the size of

the

the splitter, but the default resizing behavior of the splitter window is

to

leave the height of the first pane unchanged and stretch the second pane,
leaving them unequal.

Most windows default to 20x20 if you don't give them a size.

My current work around for this problem is to define an InitShow method

for

the panel which calls splitter.SplitHorizontally. Then, I make the OnInit
method of the application class call frame.panel.InitShow immediately

after

calling frame.Show.

Is there a better way to do this? In particular, is there an event which

is

always triggered after the window is shown,

You could try doing it on the first call to an EVT_ACTIVATE handler attached
to the frame, and just ignore it for subsequent calls.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com
http://wxPython.org Java give you jitters?
http://wxPROs.com Relax with wxPython!

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users