Sizers and stacked panels

Partridge Michael-A13286 wrote:

Hi all,

Working with wxPython 2.4.2.4, python 2.2.3, Solaris 8.

I'm attempting to write a preferences editor similar to the old Netscape
preferences dialog (I don't know if it's changed, I haven't really looked since 4.79).

Anyway, basically what I want is a wxTreeCtrl on the left, with different
wxPanels on the right when I click different nodes in the tree. The way I've tried to implement this is with a panel that has many other panels
as children, and when I click a particular node in the tree I Show() the
appropriate panel and hide the previous one.

The problem I'm having is getting sizers to operate correctly - I can't seem to get the parent panel to have the minimum size of the largest of
it's children panels (this minimum size should then go up the hierarchy to determine the minimum size of the dialog). I've attached some code
that sort of does this, but I'm not very pleased with the result.

I think what I'd really like is a notebook that doesn't have any tabs.
I could then use the existing notebook sizer support to do the resizing
and the show/hide mechanism would just be selecting a page.

Does anyone have an example of this, or am I way off base with my current design/ideas?

Derive your main panel from wx.PyPanel and override the DoGetBestSize method. In that method you can traverse all the child panels and call their GetBestSize methods to find the largest width and height. Add that to the size needed for the tree and then return the size value.

ยทยทยท

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