.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.agw.buttonpanel
.. highlight:: python
.. _wx.lib.agw.buttonpanel.BoxSizer:
==========================================================================================================================================
|phoenix_title| **wx.lib.agw.buttonpanel.BoxSizer**
==========================================================================================================================================
Pseudo-class that imitates :class:`BoxSizer`.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
BoxSizer:
|
|super_classes| Known Superclasses
==================================
:class:`wx.BoxSizer`, :class:`wx.lib.agw.buttonpanel.Sizer`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.agw.buttonpanel.BoxSizer.__init__` Constructor for :class:`BoxSizer`.
:meth:`~wx.lib.agw.buttonpanel.BoxSizer.Add` Appends a child item to the sizer.
:meth:`~wx.lib.agw.buttonpanel.BoxSizer.Insert` Inserts a child item into the sizer.
:meth:`~wx.lib.agw.buttonpanel.BoxSizer.Layout` Call this to force layout of the children anew, e.g. after having added a
:meth:`~wx.lib.agw.buttonpanel.BoxSizer.Prepend` Prepends a child item to the sizer.
:meth:`~wx.lib.agw.buttonpanel.BoxSizer.Remove` Removes an item from the sizer and destroys it.
:meth:`~wx.lib.agw.buttonpanel.BoxSizer.Show` Shows or hides the sizer item.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: BoxSizer(Sizer, wx.BoxSizer)
Pseudo-class that imitates :class:`BoxSizer`.
.. method:: __init__(self, orient=wx.HORIZONTAL)
Constructor for :class:`BoxSizer`.
:param integer `orient`: may be one of ``wx.VERTICAL`` or ``wx.HORIZONTAL`` for creating
either a column sizer or a row sizer.
.. method:: Add(self, item, proportion=0, flag=0, border=0, userData=None)
Appends a child item to the sizer.
:param `item`: the item to be added to :class:`BoxSizer`. Can be an instance of :class:`wx.Window`,
:class:`wx.Sizer` or a spacer;
:param integer `proportion`: this parameter is used in :class:`BoxSizer` to indicate if a child of
a sizer can change its size in the main orientation of the :class:`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 :class:`BoxSizer`. For example, you might have
a horizontal :class:`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.
:param integer `flag`: 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`` | These flags are used to specify which side(s) of the sizer |
| | ``wx.BOTTOM`` | item the border width will apply to. |
| | ``wx.LEFT`` | |
| | ``wx.RIGHT`` | |
| | ``wx.ALL`` | |
+-----------------------------------------------------------------------+------------------------------------------------------------------------------+
| ``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 :class:`wx.Sizer` will use |
| | :meth:`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`` | The ``wx.ALIGN*`` flags allow you to specify the alignment of the item |
| | ``wx.ALIGN_LEFT`` | within the space allotted to it by the sizer, adjusted for the border if |
| | ``wx.ALIGN_RIGHT`` | any. |
| | ``wx.ALIGN_TOP`` | |
| | ``wx.ALIGN_BOTTOM`` | |
| | ``wx.ALIGN_CENTER_VERTICAL`` **or** ``wx.ALIGN_CENTRE_VERTICAL`` | |
| | ``wx.ALIGN_CENTER_HORIZONTAL`` **or** ``wx.ALIGN_CENTRE_HORIZONTAL``| |
+-----------------------------------------------------------------------+------------------------------------------------------------------------------+
:param integer `border`: determines the border width, if the flag parameter is set
to include any border flag.
:param object `userData`: 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.
.. method:: Insert(self, before, item, proportion=0, flag=0, border=0, userData=None, realIndex=None)
Inserts a child item into the sizer.
.. seealso:: :meth:`BoxSizer.Add` method for an explanation of the input parameters.
.. method:: 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.
.. method:: Prepend(self, item, proportion=0, flag=0, border=0, userData=None)
Prepends a child item to the sizer.
.. seealso:: :meth:`BoxSizer.Add` method for an explanation of the input parameters.
.. method:: 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
:meth:`BoxSizer.Layout() ` to update the layout on screen after removing a child from
the sizer.
:param integer `indx`: the zero-based index of an item to remove;
:param bool `pop`: whether to remove the sizer item from the list of children.
.. method:: Show(self, item, show=True)
Shows or hides the sizer item.
:param `item`: the sizer item we want to show/hide;
:param bool `show`: ``True`` to show the item, ``False`` to hide it.