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

.. highlight:: python



.. _wx.lib.agw.pycollapsiblepane.PyCollapsiblePane:

==========================================================================================================================================
|phoenix_title|  **wx.lib.agw.pycollapsiblepane.PyCollapsiblePane**
==========================================================================================================================================

:class:`PyCollapsiblePane` is a container with an embedded button-like control which
can be used by the user to collapse or expand the pane's contents.



|

|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>PyCollapsiblePane</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.lib.agw.pycollapsiblepane.PyCollapsiblePane_inheritance.png" alt="Inheritance diagram of PyCollapsiblePane" 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.lib.agw.pycollapsiblepane.PyCollapsiblePane.html" title="wx.lib.agw.pycollapsiblepane.PyCollapsiblePane" alt="" coords="5,392,341,421"/> <area shape="rect" id="node2" href="wx.Panel.html" title="wx.Panel" alt="" coords="133,315,213,344"/> <area shape="rect" id="node3" href="wx.Window.html" title="wx.Window" alt="" coords="125,237,222,267"/> <area shape="rect" id="node4" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="109,160,238,189"/> <area shape="rect" id="node5" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="115,83,232,112"/> <area shape="rect" id="node6" href="wx.Object.html" title="wx.Object" alt="" coords="70,5,157,35"/> <area shape="rect" id="node7" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="181,5,288,35"/> </map> 
   </p>
   </div>

|


|appearance| Control Appearance
===============================

|

.. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.agw.pycollapsiblepane.pycollapsiblepane.png
   :alt: wxMSW
   :figclass: floatleft

   **wxMSW**


.. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png
   :alt: wxMAC
   :figclass: floatright

   **wxMAC**


.. figure:: _static/images/widgets/fullsize/wxgtk/wx.lib.agw.pycollapsiblepane.pycollapsiblepane.png
   :alt: wxGTK
   :figclass: floatcenter

   **wxGTK**


|




|super_classes| Known Superclasses
==================================

:class:`wx.Panel`

|


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

================================================================================ ================================================================================
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.__init__`                 Default class constructor.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.Collapse`                 Collapses or expands the pane window.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.DoGetBestSize`            Gets the size which best suits the window: for a control, it would be the
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.Expand`                   Same as :meth:`~PyCollapsiblePane.Collapse` (False).
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.GetAGWWindowStyleFlag`    Returns the :class:`PyCollapsiblePane` window style.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.GetBorder`                Returns the :class:`PyCollapsiblePane` border in pixels (platform dependent).
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.GetBtnLabel`              Returns the button label.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.GetButton`                Returns the button associated with :class:`PyCollapsiblePane`.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.GetButtonFont`            Returns the button font.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.GetExpanderDimensions`    Returns the expander dimensions, a tuple of integers representing the
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.GetLabel`                 Returns the button label.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.GetPane`                  Returns a reference to the pane window. Use the returned :class:`wx.Window` as
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.HasAGWFlag`               Returns whether a flag is present in the :class:`PyCollapsiblePane` style.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.IsCollapsed`              Returns ``True`` if the pane window is currently hidden.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.IsExpanded`               Returns ``True`` if the pane window is currently shown.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.Layout`                   Layout the :class:`PyCollapsiblePane`.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.OnButton`                 Handles the ``wx.EVT_BUTTON`` event for :class:`PyCollapsiblePane`.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.OnDrawGTKExpander`        Overridable method to draw the GTK-style expander.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.OnDrawGTKStyle`           Handles the ``wx.EVT_PAINT`` event for :class:`PyCollapsiblePane`.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.OnDrawGTKText`            Overridable method to draw the :class:`PyCollapsiblePane` text in the expander.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.OnSize`                   Handles the ``wx.EVT_SIZE`` event for :class:`PyCollapsiblePane`.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.OnStateChange`            Handles the status changes (collapsing/expanding).
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.SetAGWWindowStyleFlag`    Sets the :class:`PyCollapsiblePane` window style flags.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.SetButton`                Assign a new button to :class:`PyCollapsiblePane`.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.SetButtonFont`            Sets the button font.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.SetExpanderDimensions`    Sets the expander width and height.
:meth:`~wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.SetLabel`                 Sets the button label.
================================================================================ ================================================================================


|


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


.. class:: PyCollapsiblePane(wx.Panel)

   :class:`PyCollapsiblePane` is a container with an embedded button-like control which
   can be used by the user to collapse or expand the pane's contents.

   .. method:: __init__(self, parent, id=wx.ID_ANY, label="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=wx.CP_DEFAULT_STYLE, validator=wx.DefaultValidator, name="PyCollapsiblePane")

      Default class constructor.
      
      :param `parent`: the :class:`PyCollapsiblePane` parent. Must not be ``None``;
      :param `id`: window identifier. A value of -1 indicates a default value;
      :param `label`: The initial label shown in the button which allows the
       user to expand or collapse the pane window.
      :param `pos`: the control position. A value of (-1, -1) indicates a default position,
       chosen by either the windowing system or wxPython, depending on platform;
      :param `size`: the control size. A value of (-1, -1) indicates a default size,
       chosen by either the windowing system or wxPython, depending on platform;
      :param `style`: the underlying :class:`Panel` window style;
      :param `agwStyle`: the AGW-specifi window style. This can be a combination of the
       following bits:
      
       ==================== =========== ==================================================
       Window Styles        Hex Value   Description
       ==================== =========== ==================================================
       ``CP_NO_TLW_RESIZE``         0x2 By default :class:`PyCollapsiblePane` resizes the top level window containing it when its own size changes. This allows to easily implement dialogs containing an optionally shown part, for example, and so is the default behaviour but can be inconvenient in some specific cases -- use this flag to disable this automatic parent resizing then.
       ``CP_GTK_EXPANDER``          0x4 Uses a GTK expander instead of a button.
       ``CP_USE_STATICBOX``         0x8 Uses a :class:`StaticBox` around :class:`PyCollapsiblePane`.
       ``CP_LINE_ABOVE``           0x10 Draws a line above :class:`PyCollapsiblePane`.
       ==================== =========== ==================================================
      
      :param `validator`: the validator associated to the :class:`PyCollapsiblePane`;
      :param `name`: the widget name.


   .. method:: Collapse(self, collapse=True)

      Collapses or expands the pane window.
      
      :param `collapse`: ``True`` to collapse the pane window, ``False`` to expand it.


   .. method:: DoGetBestSize(self)

      Gets the size which best suits the window: for a control, it would be the
      minimal size which doesn't truncate the control, for a panel - the same size
      as it would have after a call to `Fit()`.
      
      :note: Overridden from :class:`Panel`.


   .. method:: Expand(self)

      Same as :meth:`~PyCollapsiblePane.Collapse` (False). 


   .. method:: GetAGWWindowStyleFlag(self)

      Returns the :class:`PyCollapsiblePane` window style.
      
      :see: :meth:`~PyCollapsiblePane.SetAGWWindowStyleFlag` for a list of possible window style flags.


   .. method:: GetBorder(self)

      Returns the :class:`PyCollapsiblePane` border in pixels (platform dependent). 


   .. method:: GetBtnLabel(self)

      Returns the button label. 


   .. method:: GetButton(self)

      Returns the button associated with :class:`PyCollapsiblePane`. 


   .. method:: GetButtonFont(self)

      Returns the button font. 


   .. method:: GetExpanderDimensions(self)

      Returns the expander dimensions, a tuple of integers representing the
      width and height of the expander, in pixels.


   .. method:: GetLabel(self)

      Returns the button label.
      
      :note: Overridden from :class:`Panel`.


   .. method:: GetPane(self)

      Returns a reference to the pane window. Use the returned :class:`wx.Window` as
      the parent of widgets to make them part of the collapsible area.


   .. method:: HasAGWFlag(self, flag)

      Returns whether a flag is present in the :class:`PyCollapsiblePane` style.
      
      :param `flag`: one of the possible :class:`PyCollapsiblePane` window styles.
      
      :see: :meth:`~PyCollapsiblePane.SetAGWWindowStyleFlag` for a list of possible window style flags.


   .. method:: IsCollapsed(self)

      Returns ``True`` if the pane window is currently hidden. 


   .. method:: IsExpanded(self)

      Returns ``True`` if the pane window is currently shown. 


   .. method:: Layout(self)

      Layout the :class:`PyCollapsiblePane`. 


   .. method:: OnButton(self, event)

      Handles the ``wx.EVT_BUTTON`` event for :class:`PyCollapsiblePane`.
      
      :param `event`: a :class:`CommandEvent` event to be processed.


   .. method:: OnDrawGTKExpander(self, dc)

      Overridable method to draw the GTK-style expander.
      
      :param `dc`: an instance of :class:`wx.DC`.


   .. method:: OnDrawGTKStyle(self, event)

      Handles the ``wx.EVT_PAINT`` event for :class:`PyCollapsiblePane`.
      
      :param `event`: a :class:`PaintEvent` event to be processed.
      
      :note: This is a drawing routine to paint the GTK-style expander.


   .. method:: OnDrawGTKText(self, dc)

      Overridable method to draw the :class:`PyCollapsiblePane` text in the expander.
      
      :param `dc`: an instance of :class:`wx.DC`.


   .. method:: OnSize(self, event)

      Handles the ``wx.EVT_SIZE`` event for :class:`PyCollapsiblePane`.
      
      :param `event`: a :class:`wx.SizeEvent` event to be processed.


   .. method:: OnStateChange(self, sz)

      Handles the status changes (collapsing/expanding).
      
      :param `sz`: an instance of :class:`wx.Size`.


   .. method:: SetAGWWindowStyleFlag(self, agwStyle)

      Sets the :class:`PyCollapsiblePane` window style flags.
      
      :param `agwStyle`: the AGW-specific window style. This can be a combination of the
       following bits:
      
       ==================== =========== ==================================================
       Window Styles        Hex Value   Description
       ==================== =========== ==================================================
       ``CP_NO_TLW_RESIZE``         0x2 By default :class:`PyCollapsiblePane` resizes the top level window containing it when its own size changes. This allows to easily implement dialogs containing an optionally shown part, for example, and so is the default behaviour but can be inconvenient in some specific cases -- use this flag to disable this automatic parent resizing then.
       ``CP_GTK_EXPANDER``          0x4 Uses a GTK expander instead of a button.
       ``CP_USE_STATICBOX``         0x8 Uses a :class:`StaticBox` around :class:`PyCollapsiblePane`.
       ``CP_LINE_ABOVE``           0x10 Draws a line above :class:`PyCollapsiblePane`.
       ==================== =========== ==================================================


   .. method:: SetButton(self, button)

      Assign a new button to :class:`PyCollapsiblePane`.
      
      :param `button`: can be the standard :class:`Button` or any of the generic
       implementations which live in :mod:`lib.buttons`.


   .. method:: SetButtonFont(self, font)

      Sets the button font.
      
      :param `font`: a valid :class:`wx.Font` object.


   .. method:: SetExpanderDimensions(self, width, height)

      Sets the expander width and height.
      
      :param `width`: an integer specifying the expander width in pixels;
      :param `height`: an integer specifying the expander height in pixels.


   .. method:: SetLabel(self, label)

      Sets the button label.
      
      :param `label`: the new button label.
      
      :note: Overridden from :class:`Panel`.


