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



.. _wx.WrapSizer:

==========================================================================================================================================
|phoenix_title|  **wx.WrapSizer**
==========================================================================================================================================

A wrap sizer lays out its items in a single line, like a box sizer –  as long as there is space available in that direction.          

Once all available space in the primary direction has been used, a new line is added and items are added there. 

So a wrap sizer has a primary orientation for adding items, and adds lines as needed in the secondary direction. 





         



.. seealso:: :ref:`wx.BoxSizer`, :ref:`wx.Sizer`, :ref:`Sizers Overview <sizers overview>`    







|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>WrapSizer</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.WrapSizer_inheritance.png" alt="Inheritance diagram of WrapSizer" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.WrapSizer.html" title="wx.WrapSizer" alt="" coords="5,237,116,267"/> <area shape="rect" id="node2" href="wx.BoxSizer.html" title="wx.BoxSizer" alt="" coords="9,160,112,189"/> <area shape="rect" id="node3" href="wx.Sizer.html" title="wx.Sizer" alt="" coords="22,83,99,112"/> <area shape="rect" id="node4" href="wx.Object.html" title="wx.Object" alt="" coords="17,5,104,35"/> </map> 
   </p>
   </div>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.WrapSizer.__init__`                                                   Constructor for a :ref:`wx.WrapSizer`.
:meth:`~wx.WrapSizer.CalcMin`                                                    Implements the calculation of a box sizer's minimal.
:meth:`~wx.WrapSizer.InformFirstDirection`                                       Not used by an application.
:meth:`~wx.WrapSizer.IsSpaceItem`                                                Can be overridden in the derived classes to treat some normal items as spacers.
:meth:`~wx.WrapSizer.RepositionChildren`                                         Method which must be overridden in the derived sizer classes.
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.WrapSizer(BoxSizer)

   **Possible constructors**::

       WrapSizer(orient=HORIZONTAL, flags=WRAPSIZER_DEFAULT_FLAGS)
       
   
   A wrap sizer lays out its items in a single line, like a box sizer  as
   long as there is space available in that direction.



   .. method:: __init__(self, orient=HORIZONTAL, flags=WRAPSIZER_DEFAULT_FLAGS)

      Constructor for a :ref:`wx.WrapSizer`.                  

      `orient`  determines the primary direction of the sizer (the most common case being  ``HORIZONTAL`` ). The flags parameter can be a combination of the values   ``EXTEND_LAST_ON_EACH_LINE``   which will cause the last item on each line to use any remaining space on that line and   ``REMOVE_LEADING_SPACES``   which removes any spacer elements from the beginning of a row. 

      Both of these flags are on by default.                  


      :param `orient`: 
      :type `orient`: int
      :param `flags`: 
      :type `flags`: int







   .. method:: CalcMin(self)

      Implements the calculation of a box sizer's minimal.                  

      It is used internally only and must not be called by the user. Documented for information.                  

      :rtype: :ref:`wx.Size`








   .. method:: InformFirstDirection(self, direction, size, availableOtherDir)

      Not used by an application.                  

      This is the mechanism by which sizers can inform sub-items of the first determined size component. The sub-item can then better determine its size requirements. 

      Returns ``True`` if the information was used (and the sub-item min size was updated).                  


      :param `direction`: 
      :type `direction`: int
      :param `size`: 
      :type `size`: int
      :param `availableOtherDir`: 
      :type `availableOtherDir`: int




      :rtype: `bool`








   .. method:: IsSpaceItem(self, item)

      Can be overridden in the derived classes to treat some normal items as spacers.                  

      This method is used to determine whether the given `item`  should be considered to be a spacer for the purposes of  ``REMOVE_LEADING_SPACES``   implementation. By default only returns ``True`` for the real spacers.                   


      :param `item`: 
      :type `item`: wx.SizerItem




      :rtype: `bool`








   .. method:: RepositionChildren(self, minSize)

      Method which must be overridden in the derived sizer classes.                  

      The implementation should reposition the children using the current total size available to the sizer ( ``m_size`` ) and the size computed by the last call to  :meth:`CalcMin` . 

                


      :param `minSize`: 
      :type `minSize`: wx.Size






      .. versionadded:: 4.1/wxWidgets-3.1.3 ,
          before this version RecalcSizes() method not taking any arguments had to be overridden in the derived classes instead.   







