phoenix_title wx.lib.agw.buttonpanel.BoxSizer

Pseudo-class that imitates BoxSizer.


class_hierarchy Class Hierarchy

Inheritance diagram for class BoxSizer:

method_summary Methods Summary

__init__

Constructor for BoxSizer.

Add

Appends a child item to the sizer.

Insert

Inserts a child item into the sizer.

Layout

Call this to force layout of the children anew, e.g. after having added a

Prepend

Prepends a child item to the sizer.

Remove

Removes an item from the sizer and destroys it.

Show

Shows or hides the sizer item.


api Class API

class BoxSizer(Sizer, wx.BoxSizer)

Pseudo-class that imitates BoxSizer.


Methods

__init__(self, orient=wx.HORIZONTAL)

Constructor for BoxSizer.

Parameters

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.

Parameters
  • 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.

    wx.EXPAND

    The item will be expanded to fill the space assigned to the item.

    wx.SHAPED

    The item will be expanded as much as possible while also maintaining its aspect ratio

    wx.FIXED_MINSIZE

    Normally wx.Sizer will use wx.Window.GetEffectiveMinSize to determine what the minimal size of window items should be, and will use that size to calculate the layout. This allows layouts to adjust when an item changes and its best size becomes different. If you would rather have a window item stay the size it started with then use wx.FIXED_MINSIZE.

    wx.RESERVE_SPACE_EVEN_IF_HIDDEN

    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 wx.ALIGN* flags allow you to specify the alignment of the item within the space allotted to it by the sizer, adjusted for the border if any.

  • 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.

Parameters
  • 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.

Parameters
  • item – the sizer item we want to show/hide;

  • show (bool) – True to show the item, False to hide it.