phoenix_title wx.StaticBox

A static box is a rectangle drawn around other windows to denote a logical grouping of items.

Note that while the previous versions required that windows appearing inside a static box be created as its siblings (i.e. use the same parent as the static box itself), since wxWidgets 2.9.1 it is possible to create them as children of wx.StaticBox itself and doing this is strongly recommended and avoids several different repainting problems that could happen when creating the other windows as siblings of the box.

So the recommended way to create static box and the controls inside it is:

def CreateControls(self):

    panel = wx.Panel(self)
    box = wx.StaticBox(panel, wx.ID_ANY, "StaticBox")

    text = wx.StaticText(box, wx.ID_ANY, "This window is a child of the staticbox")

    # Other code...

Creating the windows with the static box parent (i.e. panel in the example above) as parent still works but can result in refresh and repaint problems.

Also note that there is a specialized wx.Sizer class ( wx.StaticBoxSizer) which can be used as an easier way to pack items into a static box.


class_hierarchy Class Hierarchy

Inheritance diagram for class StaticBox:

appearance Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


method_summary Methods Summary

__init__

Default constructor.

Create

Creates the static box for two-step construction.

Enable

Enables or disables the box without affecting its label window, if any.

GetBordersForSizer

Returns extra space that may be needed for borders within a StaticBox.

GetClassDefaultAttributes


api Class API

class wx.StaticBox(Control)

Possible constructors:

StaticBox() -> None

StaticBox(parent, id=ID_ANY, label