[wxPython] size matters

Hi,
either both Ralf Grosse-Kunstleve and myself are missing something about
sizer and the likes or there is something that doesn't work as expected
with wxPython.
In my experience sizers and notebooks don't mix well and, generally,
building interfaces with nested containers and variuos controls is nearly
impossible.
I tried to handle size matters in my own code but then I start to figth
with the design of wxWindows. If I set a sizer on a component why
sizer.GetMinSize and component.GetBestSize don't return the same value?
If they return a different value how does a sizer compute the right
size if a child has an associated sizer (and in fact it doesn't)?

Ciao,
  Davide.

I tried to handle size matters in my own code but then I start to figth
with the design of wxWindows. If I set a sizer on a component why
sizer.GetMinSize and component.GetBestSize don't return the same value?

The initial minimum size of a sizer component is the size the component had
when added to the sizer. This is not necessarily the same as GetBestSize,
depending on the class.

If they return a different value how does a sizer compute the right
size if a child has an associated sizer (and in fact it doesn't)?

Sizers don't check if the windows they contain have sizers themselves. What
does work (and they way sizers were designed) is nesting sizers within
sizers and then adding the windows to the nested sizers.

If you do need to add windows with their own sizers to an outer sizer, it
should work too, but you'll probably need to do one of two things to make it
happen.

1) Make sure the nested window with sizer is already sized to it's min size
before adding it to the outer sizer. One way to do this is to use the Fit
method of the inner sizer passing the nested window.

2) Once the nested window has been added to the outer sizer you can call
outer.SetItemMinSize(window, width, height)

If these don't work send me an example of what you are trying to do and I'll
take a look.

···

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