using a static box around a sizer and its items

How do you do this? Do you use a StaticBox or a StaticBoxSizer? I read in the docs how they need to be siblings of each other, and not parent/child, but it still doesn't seem to put them together properly (at least not in XRC).

Also, what's the difference between the above two widgets?

A StaticBox is a window, whereas a StaticBoxSizer is a sizer, now xrced (which is helpful to use) allows just a StaticBoxSizer without requiring a StaticBox inside it, which seems to work well, it puts a box around the controls in it, so you don’t need another sizer, though you can certainly put a sizer inside a StaticBoxSizer if you wish.

Lee ← All this subject to the input of the expert-folks

···

On Thu, 2006-11-09 at 16:12 -0500, John Salerno wrote:

How do you do this? Do you use a StaticBox or a StaticBoxSizer? I read
in the docs how they need to be siblings of each other, and not
parent/child, but it still doesn't seem to put them together properly
(at least not in XRC).

Also, what's the difference between the above two widgets?

“There is nothing remarkable about it. All one has to do is press the right keys at the right time and the computer programs itself.” (ala J.S. Bach)

Unless otherwise stated, any views presented in this e-mail are solely those of the author and do not necessarily represent those of the company.

Lee Merrill wrote:

A StaticBox is a window, whereas a StaticBoxSizer is a sizer,

Just a bit more clarification: A wx.StaticBoxSizer is a wx.BoxSizer that also wraps a wx.StaticBox around the contents managed by the box sizer.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Lee Merrill wrote:

A StaticBox is a window, whereas a StaticBoxSizer is a sizer,

Just a bit more clarification: A wx.StaticBoxSizer is a wx.BoxSizer that also wraps a wx.StaticBox around the contents managed by the box sizer.

But how do you get items inside a StaticBox? Even when I make them siblings, like the docs say to do, everything appears on top of each other.

And for a StaticBoxSizer, I assume you always have to add an additional sizer inside, if a BoxSizer isn't enough for what you want? That much is easy, and I've kind of been experimenting with it. I'm just still a little confused about using just a StaticBox.

For example, if I want a StaticBox around a set of controls that will be arranged with a FlexGridSizer, it seems inefficient to use a StaticBoxSizer first, then add a FlexGridSizer to that. The better option seems to be to create a StaticBox and then have the sizer inside it, but I don't know how to get it inside of it.

John,

   Here's an example from my model application:

     TermSetBox = wx.StaticBox(self, wx.ID_ANY, label=' Fuzzy Term Set ', size=wx.Size(600, 60),
                        style=wx.RAISED_BORDER)
     TermSetSizer = wx.StaticBoxSizer(TermSetBox, wx.VERTICAL)
     TermSetSizer.Add(row4, 0, wx.EXPAND|wx.ALL, 5)

   The attached partial screen shot shows what it looks like.

Rich

···

On Fri, 10 Nov 2006, John Salerno wrote:

But how do you get items inside a StaticBox? Even when I make them siblings, like the docs say to do, everything appears on top of each other.

--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc.(TM) | Accelerator
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

John Salerno wrote:

Robin Dunn wrote:

Lee Merrill wrote:

A StaticBox is a window, whereas a StaticBoxSizer is a sizer,

Just a bit more clarification: A wx.StaticBoxSizer is a wx.BoxSizer that also wraps a wx.StaticBox around the contents managed by the box sizer.

But how do you get items inside a StaticBox?

Either manually position them there if you are not using a sizer, or just use the sizer, like this:

1. create the wx.StaticBox
2. create the wx.StaticBoxSizer, giving it the static box
3. create your other widgets
4. Add() your other widgets to the static box sizer.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Either manually position them there

Oh! I didn't even consider that! I thought it was a little fancier than that. I guess it's always better to just use the StaticBoxSizer then, right? Since you can still put a more complicated sizer inside of it for various layouts...

John Salerno wrote:

Robin Dunn wrote:

Either manually position them there

Oh! I didn't even consider that! I thought it was a little fancier than that. I guess it's always better to just use the StaticBoxSizer then, right? Since you can still put a more complicated sizer inside of it for various layouts...

Yep.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!