Grouping controls with a StaticBox control
The StaticBox
control is a type of static control that is used to group or organize controls that perform related actions together. It provides a label text and an outlining border around the grouped controls. In previous versions of wxPython, StaticBox
had an irregular sibling relationship with the controls that it contained, which was, needless to say, outside the mold of the overall hierarchy of the framework. However, starting from version 2.9 onward, StaticBox
can be treated similarly to a special panel that is the parent of the controls it contains. In this recipe, we will take a quick look at how to add controls to StaticBox
.
How to do it…
Here are the steps for this recipe:
- First, let's start off by making a little wrapper class around
StaticBox
to encapsulateStaticBoxSizer
and add a couple of convenience methods, as follows:class GroupBox(wx.StaticBox): def __init__(self, parent, orient, label=""): super...