Container for sizer items flags providing readable names for them.
Normally, when you add an item to a sizer via wx.Sizer.Add
, you have to specify a lot of flags and parameters which can be unwieldy. This is where wx.SizerFlags comes in: it allows you to specify all parameters using the named methods instead. For example, instead of
sizer.Add(ctrl, 0, wx.EXPAND | wx.ALL, 10)
you can now write
sizer.Add(ctrl, wx.SizerFlags().Expand().Border(wx.ALL, 10))
This is more readable and also allows you to create wx.SizerFlags objects which can be reused for several sizer items.
flagsExpand = wx.SizerFlags(1)
flagsExpand.Expand().Border(wx.ALL, 10)
sizer.Add(ctrl1, flagsExpand)
sizer.Add(ctrl2, flagsExpand)
Note that by specification, all methods of wx.SizerFlags return the wx.SizerFlags object itself to allowing chaining multiple methods calls like in the examples above.
See also
__init__ |
Creates the wx.Sizer with the proportion specified by proportion. |
Align |
Sets the alignment of this wx.SizerFlags to align. |
Border |
Sets the wx.SizerFlags to have a border of a number of pixels specified by borderinpixels with the directions specified by direction. |
Bottom |
Aligns the object to the bottom, similar for Align(wxALIGN_BOTTOM) . |
Center |
Sets the object of the wx.SizerFlags to center itself in the area it is given. |
Centre |
wx.Center for people with the other dialect of English. |
DoubleBorder |
Sets the border in the given direction having twice the default border size. |
DoubleHorzBorder |
Sets the border in left and right directions having twice the default border size. |
Expand |
Sets the object of the wx.SizerFlags to expand to fill as much area as it can. |
FixedMinSize |
Set the FIXED_MINSIZE flag which indicates that the initial size of the window should be also set as its minimal size. |
GetDefaultBorder |
Returns the border used by default in wx.Border method. |
Left |
Aligns the object to the left, similar for Align(wxALIGN_LEFT) . |
Proportion |
Sets the proportion of this wx.SizerFlags to proportion. |
ReserveSpaceEvenIfHidden |
Set the RESERVE_SPACE_EVEN_IF_HIDDEN flag. |
Right |
Aligns the object to the right, similar for Align(wxALIGN_RIGHT) . |
Shaped |
Set the _SHAPED flag which indicates that the elements should always keep the fixed width to height ratio equal to its original value. |
Top |
Aligns the object to the top, similar for Align(wxALIGN_TOP) . |
TripleBorder |
Sets the border in the given direction having thrice the default border size. |
wx.
SizerFlags
(object)¶Possible constructors:
SizerFlags(proportion=0)
Container for sizer items flags providing readable names for them.
__init__
(self, proportion=0)¶Creates the wx.Sizer with the proportion specified by proportion.
Parameters: | proportion (int) – |
---|
Align
(self, alignment)¶Sets the alignment of this wx.SizerFlags to align.
This method replaces the previously set alignment with the specified one.
Parameters: | alignment (int) – Combination of ALIGN_XXX bit masks. |
---|---|
Return type: | wx.SizerFlags |
See also
wx.Top
, wx.Left
, wx.Right
, wx.Bottom
, wx.Centre
Border
(self, *args, **kw)¶Border (self, direction, borderinpixels)
Sets the wx.SizerFlags to have a border of a number of pixels specified by borderinpixels with the directions specified by direction.
Parameters: |
|
---|---|
Return type: |
Border (self, direction=ALL)
Sets the wx.SizerFlags to have a border with size as returned by GetDefaultBorder
.
Parameters: | direction (int) – Direction(s) to apply the border in. |
---|---|
Return type: | wx.SizerFlags |
Bottom
(self)¶Aligns the object to the bottom, similar for Align(wxALIGN_BOTTOM)
.
Unlike Align
, this method doesn’t change the horizontal alignment of the item.
Return type: | wx.SizerFlags |
---|
Center
(self)¶Sets the object of the wx.SizerFlags to center itself in the area it is given.
Return type: | wx.SizerFlags |
---|
Centre
(self)¶wx.Center
for people with the other dialect of English.
Return type: | wx.SizerFlags |
---|
DoubleBorder
(self, direction=ALL)¶Sets the border in the given direction having twice the default border size.
Parameters: | direction (int) – |
---|---|
Return type: | wx.SizerFlags |
DoubleHorzBorder
(self)¶Sets the border in left and right directions having twice the default border size.
Return type: | wx.SizerFlags |
---|
Expand
(self)¶Sets the object of the wx.SizerFlags to expand to fill as much area as it can.
Return type: | wx.SizerFlags |
---|
FixedMinSize
(self)¶Set the FIXED_MINSIZE
flag which indicates that the initial size of the window should be also set as its minimal size.
Return type: | wx.SizerFlags |
---|
Left
(self)¶Aligns the object to the left, similar for Align(wxALIGN_LEFT)
.
Unlike Align
, this method doesn’t change the vertical alignment of the item.
Return type: | wx.SizerFlags |
---|
Proportion
(self, proportion)¶Sets the proportion of this wx.SizerFlags to proportion.
Parameters: | proportion (int) – |
---|---|
Return type: | wx.SizerFlags |
ReserveSpaceEvenIfHidden
(self)¶Set the RESERVE_SPACE_EVEN_IF_HIDDEN
flag.
Normally Sizers don’t allocate space for hidden windows or other items. This flag overrides this behaviour 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.
Return type: | wx.SizerFlags |
---|
New in version 2.8.8.
Right
(self)¶Aligns the object to the right, similar for Align(wxALIGN_RIGHT)
.
Unlike Align
, this method doesn’t change the vertical alignment of the item.
Return type: | wx.SizerFlags |
---|
Shaped
(self)¶Set the _SHAPED
flag which indicates that the elements should always keep the fixed width to height ratio equal to its original value.
Return type: | wx.SizerFlags |
---|
Top
(self)¶Aligns the object to the top, similar for Align(wxALIGN_TOP)
.
Unlike Align
, this method doesn’t change the horizontal alignment of the item.
Return type: | wx.SizerFlags |
---|
TripleBorder
(self, direction=ALL)¶Sets the border in the given direction having thrice the default border size.
Parameters: | direction (int) – |
---|---|
Return type: | wx.SizerFlags |