[wxPython-users] boxsizer problems

Dan Cherry dscherry at bellsouth.net
Fri Sep 22 17:40:37 PDT 2006


Phil Mayes wrote:
> At 05:03 PM 9/22/2006, you wrote:
>> Hi,
>> I've been trying to create a vertical boxsizer containing two static 
>> box sizers and a sub panel between them.  My problem is, I haven't 
>> been able to force the static boxsizers to their maximum size.  It 
>> seems that whatever text is in the sizer at the time the main sizer is 
>> set, determines the size of the static boxsizer, not the size I set in 
>> the option.
>>
>> Is there a way to direct the sizers to display the entire staticbox, 
>> rather than just the text within it.
>>
>> I've included a sample of the code, and made the sub panel green for 
>> easy visibility.  The goal is for the two staticBoxsizers to display a 
>> size of (100,150).   Thanks in advance for any suggestions.
> 
> Use SetMinSize.  You may want to set proportion for centerpanel to 1, 
> see below.
> 
Thank you Phil, That worked perfectly!  Appreciate it very much (I spent 
most of the day reading what I could find, and with trial and error- 
nice to have a solution)
Dan


> HTH, Phil Mayes
> 
>     def createSizers(self):
>         upperBoxSizer = wx.StaticBoxSizer(self.upperBox, wx.VERTICAL)
>         upperBoxSizer.SetMinSize((100, 150))
>         upperBoxSizer.Add(self.upperText, 0, wx.ALL|wx.ALIGN_CENTER)
> 
>         lowerBoxSizer = wx.StaticBoxSizer(self.lowerBox, wx.VERTICAL)
>         lowerBoxSizer.SetMinSize((100, 150))
>         lowerBoxSizer.Add(self.lowerText, 0, wx.ALL|wx.ALIGN_CENTER)
> 
>         leftSizer = wx.BoxSizer(wx.VERTICAL)
>         leftSizer.Add(upperBoxSizer, 0, wx.ALIGN_CENTER|wx.ALL, 3)
>         leftSizer.Add(self.centerpanel, 1, wx.ALIGN_CENTER|wx.ALL, 3)
>         leftSizer.Add(lowerBoxSizer, 0, wx.ALIGN_CENTER|wx.ALL, 3)
> 
>         self.SetSizerAndFit(leftSizer)
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
> 


-- 
Dan Cherry
dscherry (@) bellsouth.net

Finding a solution to a problem doesn't solve the problem...
Implementing the solution solves the problem.




More information about the wxpython-users mailing list