It's one of the silly things that happen when it comes to sizers. You must specify the size of your spacer (that's the (1,1) value), but then by specifying a weight (proportion) of 1, you are telling the ASizer to stretch it to fill up the space, resulting in a spacing much different than (1,1).
It's the same as if you were to put a 20-pixel-high text control in that sizer; although you've specified a height of 20, the sizer will use the specified proportion to change that size, and as you resize the frame, the textbox's height will continue to change. If you don't want a variable size, you need to specify a proportion of 0, which tells the sizer to only allocate enough space to display the object's 'natural' size.
So, the (1,1) is a default space not related to anything in particular?
What I'm trying to do is add space below a radiobox and above a static
horizontal line, then another space below the static horizontal line and the
next widget. I do want it to expand and contract as the main frame is resized
by the user.
Is this not the wxPython way? Do we let the sizer determine the spacing,
even when it appears too close to us?
Thanks for the insight.
Rich
···
On Mon, 21 Nov 2005, Ed Leafe wrote:
It's one of the silly things that happen when it comes to sizers. You
must specify the size of your spacer (that's the (1,1) value), but then by
specifying a weight (proportion) of 1, you are telling the ASizer to
stretch it to fill up the space, resulting in a spacing much different than
(1,1).
--
Richard B. Shepard, Ph.D. | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
The sizer determines the spacing based upon the default sizes of the objects first. It then divides up the remaining space among the objects according to their proportion setting.
In your example, if you wanted the space to grow with a larger frame, but to never get smaller than N pixels, you would make the spacer (1, N), and add it with a proportion of 1. Then, if you shrink the form, the sizer will not make the spacer smaller than N pixels high.
So, the (1,1) is a default space not related to anything in particular?
What I'm trying to do is add space below a radiobox and above a static
horizontal line, then another space below the static horizontal line and the
next widget. I do want it to expand and contract as the main frame is resized
by the user.
Is this not the wxPython way? Do we let the sizer determine the spacing,
even when it appears too close to us?
In your example, if you wanted the space to grow with a larger frame, but
to never get smaller than N pixels, you would make the spacer (1, N), and
add it with a proportion of 1. Then, if you shrink the form, the sizer will
not make the spacer smaller than N pixels high.
Now it's all in perspective. Thanks very much.
Rich
···
On Mon, 21 Nov 2005, Ed Leafe wrote:
--
Richard B. Shepard, Ph.D. | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863