Widgets such as button, text box, etc. are placed on a panel window. wx.Panel class is usually put inside a wxFrame object. This class is also inherited from wxWindow class.
Although controls can be manually placed on panel by specifying the position in screen coordinates, it is recommended to use a suitable layout scheme, called sizer in wxPython, to have better control over the placement and address the resizing issue.
In wxPanel constructor, the parent parameter is the wx.Frame object in which the panel is to be placed. Default value of id parameter is wx.ID_ANY, whereas the default style parameter is wxTAB_TRAVERSAL.
wxPython API has the following sizers, using which controls are added into a panel object −
|S.N.||Sizers & Description|
Widgets are arranged in a vertical or horizontal box
Adds a staticbox around the sizer
One control each added in equal sized cells of a grid
Control added in cell grid can occupy more than one cell
Controls explicitly positioned in a grid and spanning over more than one row and/or column
Sizer object is applied as the layout manager of the panel using SetSizer() method of wxPanel class.
Panel object in turn is added to the top level frame.