vicki@stanfield.net wrote:
I finally figured this out. I still don't completely
understand the parameters for the call to Add. The
relevant code was:
................
panel1 = ComboBoxPanel(self,-1, size=(100,100),
style=wxSUNKEN_BORDER)
panel2 = SecondPanel(self, -1, size=(100,100),
style=wxSUNKEN_BORDER)
box = wxBoxSizer(wxVERTICAL)
box.Add(panel1, 0,
wxGROW>wxALIGN_CENTER_VERTICAL|wxALL, 2)
box.Add(panel2, 1,
wxGROW>wxALIGN_CENTER_VERTICAL|wxALL, 2)
...............
I had to change the 0 in the box.Add call for panel2 to
a 1. I have looked for clarification of the parameters
but the wxWindow site is for C++ and that is a bit
confusing. Is there a clear explanation of this
somewhere? Or can someone just hook me up with an
explanation of these arguments?
--vicki
See
http://wiki.wxpython.org/index.cgi/UsingSizers
and the included link to the wxDesigner tutorial.
Briefly, the second parameter, proportion, (but called option in later versions and possibly still in wxPython) is a weight which determines how the different controls you add to the sizer share the available size in the main direction of the box sizer (i.e. vertical for wxVERTICAL). If the proportion for a given control is 0, then that item will use the default size for that control (so, for a button, enough to hold the text). Otherwise, all controls with non-zero proportion share the remaining space in proportion to their proportion values (i.e. two controls with proportion 1 will get equal space, one with proportion 2 will get twice as much space, etc.).
The third parameter, flag, has two functions (which is a confusing design). First, it determines how the controls in the sizer grow in the perpendicular direction. The choices are 0 (doesn't grow), wxGROW or wxEXPAND (grow to fill the space), and wxSHAPED (grow to preserve the original aspect ratio of the control as it resizes in the main direction). Second, it determines how the control is aligned within the available space both vertically and horizontally (wxALIGN_CENTER, wxALIGN_TOP, etc.). You make a choice for perpendicular growth and a choice for alignment and combine the two choices with a bitwise or (e.g. wxGROW | wxALIGN_CENTER).
The fourth parameter determines how large a border the sizer leaves around a control (in pixels).
David