sizers problems in 2.5.4.1

I tried to migrate my app from 2.5.3.1 to 2.5.4.1
but I have 2 problems with what I think is due tosizers.

First my app when it starts is to big and I cant resize
to a smaller size.

Second is that in some panels when I resize
to a smaller frame the widgets arent recalculated. I.e when I make the frame
bigger the widgets expands but when I make the frame smaller they
dont get smaller.

I tried to make a testcase but didnt succeed.

Can I somehow set the behaviour in calculations of sizers to
how it was in 2.5.3.1? Or any hints how to solve my problems?

Best regards,

/T

Hello Toni,

I tried to migrate my app from 2.5.3.1 to 2.5.4.1
but I have 2 problems with what I think is due tosizers.

First my app when it starts is to big and I cant resize
to a smaller size.

Second is that in some panels when I resize
to a smaller frame the widgets arent recalculated. I.e when I make the

frame

bigger the widgets expands but when I make the frame smaller they
dont get smaller.

I tried to make a testcase but didnt succeed.

Can I somehow set the behaviour in calculations of sizers to
how it was in 2.5.3.1? Or any hints how to solve my problems?

You should post some code (the smaller, the better) in order to let us understand
which is the problem...

Andrea.

Toni Brkic wrote:

I tried to migrate my app from 2.5.3.1 to 2.5.4.1
but I have 2 problems with what I think is due tosizers.

First my app when it starts is to big and I cant resize
to a smaller size.

Do you use sizer.SetSizeHints or similar on the Frame? When the frame's minsize or hints are set then it won't resize smaller than the size it is given.

Second is that in some panels when I resize
to a smaller frame the widgets arent recalculated. I.e when I make the frame
bigger the widgets expands but when I make the frame smaller they
dont get smaller.

This can happen if a widget does not have it's own DoGetBestSize method (used by the sizers to determine the default minsize, see wx.lib.buttons for an example) or an explicit minsize set. The default DoGetBestSize goes through these steps to try and figure out what the "best" size is:

* If the window has a sizer then ask it what the best minsize would be.

* If the window has layout constraints then ask the constriaint

* if the window has children then calculate a size that is big enough for all of the children to be visible

* if the window has a set minsize then use that

* otherwise use the current size.

So in your case if is getting to this last case and so the sizer is getting told that its current size is the best/min size. Then the sizer expands the window because you told it to. Then on the next resize event it asks it again and now it gives the new current size, so the sizer won't shrink it past the current.

You can work around this by one of these approaches:

* call the window's SetMinSize method

* Add the window to the sizer with the wx.FIXED_MINSIZE flag

* Derive the window from wx.PyWindow, wx.PyControl, or wx.PyPanel and give it a DoGetBestSize method that calculates the bese size based on the window's content.

ยทยทยท

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