wx.SizerFlags

Inheritance diagram for wx.SizerFlags:



Description

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.BORDER, 10)

You can now write:

sizer.Add(ctrl, wx.SizerFlags().Expand().Border(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(10)

sizer.Add(ctrl1, flagsExpand)
sizer.Add(ctrl2, flagsExpand)

Note

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.

Class API

Methods

__init__(proportion=0)

Constructs the flags object with the specified proportion.

Parameters:

  • proportion (int)

Returns:

wx.SizerFlags


Align(align=0)

Sets the alignment of this wx.SizerFlags to align.

Parameters:

  • align (int)

Returns:

wx.SizerFlags

Note

Note that if this method is not called, the wx.SizerFlags has no specified alignment.

See also

Left, Right, Centre


Border(direction=wx.ALL, borderinpixels=-1)

Sets the wx.SizerFlags to have a border of a number of pixels specified by borderinpixels with the directions specified by direction.

Parameters:

  • direction (int)
  • borderinpixels (int)

Returns:

wx.SizerFlags


Bottom()

Aligns the object to the bottom of the available space, a shortcut for calling Align (wx.ALIGN_BOTTOM).


Returns:

wx.SizerFlags


Center()

Sets the object of the wx.SizerFlags to center itself in the area it is given.


Returns:

wx.SizerFlags


Centre()

Center for people with the other dialect of english.


Returns:

wx.SizerFlags


DoubleBorder(direction=wx.ALL)

Sets the border in the given direction having twice the default border size.

Parameters:

  • direction (int)

Returns:

wx.SizerFlags


DoubleHorzBorder()

Sets the border in left and right directions having twice the default border size.


Returns:

wx.SizerFlags


Expand()

Sets the object of the wx.SizerFlags to expand to fill as much area as it can.


Returns:

wx.SizerFlags


FixedMinSize()

Set the wx.FIXED_MINSIZE flag which indicates that the initial size of the window should be also set as its minimal size.


Returns:

wx.SizerFlags


GetBorderInPixels()

Returns the border value in pixels to be used in the sizer item.


Returns:

int


GetDefaultBorder()

Returns the border used by default in Border method.


Returns:

int


GetFlags()

Returns the flags value to be used in the sizer item.


Returns:

int


GetProportion()

Returns the proportion value to be used in the sizer item.


Returns:

int


HorzBorder()

Sets the left and right borders to the default border size.


Returns:

wx.SizerFlags


Left()

Aligns the object to the left, shortcut for Align (wx.ALIGN_LEFT).


Returns:

wx.SizerFlags

See also

Align


Proportion(proportion=0)

Sets the proportion of this wx.SizerFlags to proportion.

Parameters:

  • proportion (int)

Returns:

wx.SizerFlags


ReserveSpaceEvenIfHidden()

Set the wx.RESERVE_SPACE_EVEN_IF_HIDDEN flag in wx.Sizer.

Normally wx.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


Returns:

wx.SizerFlags

See also

wx.Sizer.Add


Aligns the object to the right, shortcut for Align (wx.ALIGN_RIGHT).


Returns:

wx.SizerFlags

See also

Align


Shaped()

Set the wx.SHAPED flag which indicates that the elements should always keep the fixed width to height ratio equal to its original value.


Returns:

wx.SizerFlags


Top()

Aligns the object to the top of the available space, a shortcut for calling Align (wx.ALIGN_TOP).


Returns:

wx.SizerFlags


TripleBorder(direction=wx.ALL)

Sets the border in the given direction having thrice the default border size.

Parameters:

  • direction (int)

Returns:

wx.SizerFlags