wxPython BoxSizer

Jamie McQuay Jamie.McQuay at googlemail.com
Wed Nov 19 10:16:21 EST 2008


Simple question, i just can't make it work.

I need to center a StaticText component in its parent (Panel).  I want
to do this with BoxSizer(s).

if i use:
box = wx.BoxSizer(wx.VERTICAL)   #or wx.HORIZONTAL
box.Add(myText,0,wx.ALIGN_CENTER)
parentPanel.Sizer = box

i can get it to center either vertically or horizontally, but not both
(i.e. the center).  I've tried myText.CenterOnParent but i need to
handle to Size event to move the text when the panel is resized and i
don't want to have to do this.

thanks,
Jamie



More information about the Python-list mailing list