Pseudo-class that imitates BoxSizer
.
wx.BoxSizer
, wx.lib.agw.buttonpanel.Sizer
Constructor for |
|
Appends a child item to the sizer. |
|
Inserts a child item into the sizer. |
|
Call this to force layout of the children anew, e.g. after having added a |
|
Prepends a child item to the sizer. |
|
Removes an item from the sizer and destroys it. |
|
Shows or hides the sizer item. |
BoxSizer
(Sizer, wx.BoxSizer)¶Pseudo-class that imitates BoxSizer
.
__init__
(self, orient=wx.HORIZONTAL)¶Constructor for BoxSizer
.
orient (integer) – may be one of wx.VERTICAL
or wx.HORIZONTAL
for creating
either a column sizer or a row sizer.
Add
(self, item, proportion=0, flag=0, border=0, userData=None)¶Appends a child item to the sizer.
item – the item to be added to BoxSizer
. Can be an instance of wx.Window
,
wx.Sizer
or a spacer;
proportion (integer) – this parameter is used in BoxSizer
to indicate if a child of
a sizer can change its size in the main orientation of the BoxSizer
- where 0
stands for not changeable and a value of more than zero is interpreted relative
to the value of other children of the same BoxSizer
. For example, you might have
a horizontal BoxSizer
with three children, two of which are supposed to change their
size with the sizer. Then the two stretchable windows would get a value of 1 each to
make them grow and shrink equally with the sizer’s horizontal dimension.
flag (integer) –
this parameter can be used to set a number of flags which can be combined using the binary OR operator |
.
Two main behaviours are defined using these flags. One is the border around a window: the border parameter determines the border
width whereas the flags given here determine which side(s) of the item that the border will be added. The other flags determine
how the sizer item behaves when the space allotted to the sizer changes, and is somewhat dependent on the specific kind of sizer used:
Sizer Flag |
Description |
---|---|
wx.TOP wx.BOTTOM wx.LEFT wx.RIGHT wx.ALL |
These flags are used to specify which side(s) of the sizer item the border width will apply to. |
|
The item will be expanded to fill the space assigned to the item. |
|
The item will be expanded as much as possible while also maintaining its aspect ratio |
|
Normally |
|
Normally Sizers don’t allocate space for hidden windows or other items. This flag overrides this behavior so that sufficient space is allocated for the window even if it isn’t visible. This makes it possible to dynamically show and hide controls without resizing parent dialog, for example. This function is new since wxWidgets version 2.8.8 |
wx.ALIGN_CENTER or wx.ALIGN_CENTRE wx.ALIGN_LEFT wx.ALIGN_RIGHT wx.ALIGN_TOP wx.ALIGN_BOTTOM wx.ALIGN_CENTER_VERTICAL or wx.ALIGN_CENTRE_VERTICAL wx.ALIGN_CENTER_HORIZONTAL or wx.ALIGN_CENTRE_HORIZONTAL |
The |
border (integer) – determines the border width, if the flag parameter is set to include any border flag.
userData (object) – Allows an extra object to be attached to the sizer item, for use in derived classes when sizing information is more complex than the proportion and flag will allow for.
Note
there is no support for userData parameter if item is a pseudocontrol, since that is already used.
Insert
(self, before, item, proportion=0, flag=0, border=0, userData=None, realIndex=None)¶Inserts a child item into the sizer.
See also
BoxSizer.Add
method for an explanation of the input parameters.
Layout
(self)¶Call this to force layout of the children anew, e.g. after having added a child to or removed a child (window, other sizer or space) from the sizer while keeping the current dimension.
Prepend
(self, item, proportion=0, flag=0, border=0, userData=None)¶Prepends a child item to the sizer.
See also
BoxSizer.Add
method for an explanation of the input parameters.
Remove
(self, indx, pop=-1)¶Removes an item from the sizer and destroys it.
This method does not cause any layout or resizing to take place, call
BoxSizer.Layout()
to update the layout on screen after removing a child from
the sizer.
indx (integer) – the zero-based index of an item to remove;
pop (bool) – whether to remove the sizer item from the list of children.
Show
(self, item, show=True)¶Shows or hides the sizer item.
item – the sizer item we want to show/hide;
show (bool) – True
to show the item, False
to hide it.