The problem boils down to the behaviour of spacers in
nested sizers.
If I create a wxStaticText control (lbl1) and a
wxTextCtrl (fld1) I can lay them out vertically with
spacers above and below with:
box=wxBoxSizer(wxVERTICAL)
box.Add(1,1,1,wxEXPAND)
box.Add(self.lbl1)
box.Add(self.fld1)
box.Add(1,1,1,wxEXPAND)
self.SetAutoLayout(true)
self.SetSizer(box)
self.Layout()
Changing wxVERTICAL to wxHORIZONTAL works fine too.
However, if boxes are nested as in:
box=wxBoxSizer(wxVERTICAL)
box2=wxBoxSizer(wxHORIZONTAL)
box2.Add(1,1,1,wxEXPAND)
box2.Add(self.lbl1)
box2.Add(self.fld1)
box2.Add(1,1,1,wxEXPAND)
box.Add(1,1,1,wxEXPAND)
box.Add(box2)
box.Add(1,1,1,wxEXPAND)
self.SetAutoLayout(true)
self.SetSizer(box)
self.Layout()
the vertical layout is as expected, but the spacers in
the nested box (box2) don't expand. Ie. everything's
on the left. I assumed that a Layout() on box and/or
box2 was required but can find no combination that
works.
Thanks in Advance,
John Bell
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
I.e.
box=wxBoxSizer(wxVERTICAL)
box2=wxBoxSizer(wxHORIZONTAL)
box2.Add(1,1,1,wxEXPAND)
box2.Add(self.lbl1,1,wxEXPAND) #add flags to ensure vertical exansion
box2.Add(self.fld1,1,wxEXPAND) # ditto
box2.Add(1,1,1,wxEXPAND)
box.Add(1,1,1,wxEXPAND)
box.Add(box2,1,wxEXPAND) # add flags to ensure horizontal exansion
box.Add(1,1,1,wxEXPAND)
self.SetAutoLayout(true)
self.SetSizer(box)
self.Layout()
hope this works.
Bryan
> _______________________________________________
> wxpython-users mailing list
> wxpytho...@lists.wxwindows.org
> http://lists.wxwindows.org/mailman/listinfo/wxpython-users
--
Bryan Cole
Teraview Ltd., 302-304 Cambridge Science Park, Milton Road, Cambridge
CB4 0WG, United Kingdom.
tel: +44 (1223) 435380 / 435386 (direct-dial) fax: +44 (1223) 435382