Cannot Position one Static Box

Ed Leafe wrote:

    Just call sizer.Add() with a wx.Size object (or just a width- height tuple). That will add a spacer of the specified size.

And this can be very useful if you make the space stretchable ("option" > 0) for instance:

ASizer.Add(AWidget, 0)
ASizer.Add((1,1), 1)
ASizer.Add(AnotherWidget, 0)

Will stretch the space, but not the Widgets, pushing them to the right and left (or top and bottom) of the Sizer.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                          
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Chris,

   Thank you.

Rich

···

On Mon, 21 Nov 2005, Chris Barker wrote:

And this can be very useful if you make the space stretchable ("option" > 0) for instance:

ASizer.Add(AWidget, 0)
ASizer.Add((1,1), 1)
ASizer.Add(AnotherWidget, 0)

Will stretch the space, but not the Widgets, pushing them to the right and
left (or top and bottom) of the Sizer.

--
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

^^^

Chris,

   What do these values represent? I've played with different numbers for the
space but cannot see a difference in the inter-widget spacing.

Rich

···

On Mon, 21 Nov 2005, Chris Barker wrote:

And this can be very useful if you make the space stretchable ("option" >
0) for instance:

ASizer.Add(AWidget, 0)
ASizer.Add((1,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

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.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com

···

On Nov 21, 2005, at 9:54 AM, Rich Shepard wrote:

ASizer.Add(AWidget, 0)
ASizer.Add((1,1), 1)

              ^^^

Chris,

  What do these values represent? I've played with different numbers for the
space but cannot see a difference in the inter-widget spacing.

Ed,

   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.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com

···

On Nov 21, 2005, at 11:01 AM, Rich Shepard wrote:

  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?

Ed,

  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