wx.FlexGridSizer

Inheritance diagram for wx.FlexGridSizer:



Description

A flex grid sizer is a sizer which lays out its children in a two-dimensional table with all table fields in one row having the same height and all fields in one column having the same width, but all rows or all columns are not necessarily the same height or width as in the wx.GridSizer.

Since wxWidgets 2.5.0, wx.FlexGridSizer can also size items equally in one direction but unequally (“flexibly”) in the other. If the sizer is only flexible in one direction (this can be changed using SetFlexibleDirection), it needs to be decided how the sizer should grow in the other (“non-flexible”) direction in order to fill the available space. The SetNonFlexibleGrowMode method serves this purpose.

See also

wx.Sizer

Known Subclasses

wx.GridBagSizer

Class API

Methods

__init__(rows=1, cols=0, vgap=0, hgap=0)

Constructor for a wx.FlexGridSizer. rows and cols determine the number of columns and rows in the sizer - if either of the parameters is zero, it will be calculated to from the total number of children in the sizer, thus making the sizer grow dynamically. vgap and hgap define extra space between all children.

Parameters:

  • rows (int)
  • cols (int)
  • vgap (int)
  • hgap (int)

Returns:

wx.FlexGridSizer


AddGrowableCol(idx, proportion=0)

Specifies that column idx (starting from zero) should be grown if there is extra space available to the sizer.

The proportion parameter has the same meaning as the stretch factor for the sizers except that if all proportions are 0, then all columns are resized equally (instead of not being resized at all).

Parameters:

  • idx (long)
  • proportion (int)

AddGrowableRow(idx, proportion=0)

Specifies that row idx (starting from zero) should be grown if there is extra space available to the sizer.

Parameters:

  • idx (long)
  • proportion (int)

See also

AddGrowableCol


GetColWidths()

Returns a list of integers representing the widths of each of the columns in the sizer.


Returns:

list


GetFlexibleDirection()

Returns a value that specifies whether the sizer flexibly resizes its columns, rows, or both (default).


Returns:

int


GetNonFlexibleGrowMode()

Returns the value that specifies how the sizer grows in the “non-flexible” direction if there is one.


Returns:

int


GetRowHeights()

Returns a list of integers representing the heights of each of the rows in the sizer.


Returns:

list


RemoveGrowableCol(idx)

Specifies that column idx is no longer growable.

Parameters:

  • idx (long)

RemoveGrowableRow(idx)

Specifies that row idx is no longer growable.

Parameters:

  • idx (long)

SetFlexibleDirection(direction)

Specifies whether the sizer should flexibly resize its columns, rows, or both. Argument direction can be wx.VERTICAL, wx.HORIZONTAL or wx.BOTH (which is the default value). Any other value is ignored.

Parameters:

  • direction (int)

Note

Note that this method does not trigger relayout.


SetNonFlexibleGrowMode(mode)

Specifies how the sizer should grow in the non-flexible direction if there is one (so SetFlexibleDirection must have been called previously). Argument mode can be one of these values:

Mode Flag Description
wx.FLEX_GROWMODE_NONE Sizer doesn’t grow in the non flexible direction.
wx.FLEX_GROWMODE_SPECIFIED Sizer honors growable columns/rows set with AddGrowableCol and AddGrowableRow. In this case equal sizing applies to minimum sizes of columns or rows (this is the default value).
wx.FLEX_GROWMODE_ALL Sizer equally stretches all columns or rows in the non flexible direction, whether they are growable or not in the flexbile direction

Parameters:

  • mode (int)

Note

Note that this method does not trigger relayout.


Properties

ColWidths
See GetColWidths
FlexibleDirection
See GetFlexibleDirection and SetFlexibleDirection
NonFlexibleGrowMode
See GetNonFlexibleGrowMode and SetNonFlexibleGrowMode
RowHeights
See GetRowHeights