.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.SplitterWindow:

==========================================================================================================================================
|phoenix_title|  **wx.SplitterWindow**
==========================================================================================================================================

This class manages up to two subwindows.          

The current view can be split into two programmatically (perhaps from a menu command), and unsplit either programmatically or via the :ref:`wx.SplitterWindow`  user interface. 





.. _SplitterWindow-styles:

|styles| Window Styles
================================

This class supports the following styles: 

  

- ``wx.SP_3D``: Draws a 3D effect border and sash.  
- ``wx.SP_THIN_SASH``: Draws a thin sash.  
- ``wx.SP_3DSASH``: Draws a 3D effect sash (part of default style).  
- ``wx.SP_3DBORDER``: Synonym for ``wx.SP_BORDER``.  
- ``wx.SP_BORDER``: Draws a standard border.  
- ``wx.SP_NOBORDER``: No border (default).  
- ``wx.SP_NO_XP_THEME``: Under Windows XP, switches off the attempt to draw the splitter using Windows XP theming, so the borders and sash will take on the pre-XP look.  
- ``wx.SP_PERMIT_UNSPLIT``: Always allow to unsplit, even with the minimum pane size other than zero.  
- ``wx.SP_LIVE_UPDATE``: Don't draw ``wx.XOR`` line but resize the child windows immediately.  








.. _SplitterWindow-events:

|events| Events Emitted by this Class
=====================================

Handlers bound for the following event types will receive a :ref:`wx.SplitterEvent` parameter.


- EVT_SPLITTER_SASH_POS_CHANGING: The sash position is in the process of being changed. May be used to modify the position of the tracking bar to properly reflect the position that would be set if the drag were to be completed at this point. Processes a  ``wxEVT_SPLITTER_SASH_POS_CHANGING``   event.   
- EVT_SPLITTER_SASH_POS_CHANGED: The sash position was changed. May be used to modify the sash position before it is set, or to prevent the change from taking place. Processes a  ``wxEVT_SPLITTER_SASH_POS_CHANGED``   event.   
- EVT_SPLITTER_UNSPLIT: The splitter has been just unsplit. Processes a  ``wxEVT_SPLITTER_UNSPLIT``   event.   
- EVT_SPLITTER_DCLICK: The sash was double clicked. The default behaviour is to unsplit the window when this happens (unless the minimum pane size has been set to a value greater than zero). Processes a  ``wxEVT_SPLITTER_DOUBLECLICKED``   event.   








         



.. seealso:: :ref:`wx.SplitterEvent`, :ref:`SplitterWindow Overview <splitterwindow 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>SplitterWindow</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.SplitterWindow_inheritance.png" alt="Inheritance diagram of SplitterWindow" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="48,83,159,112"/> <area shape="rect" id="node5" href="wx.Window.html" title="wx.Window" alt="" coords="59,160,148,189"/> <area shape="rect" id="node2" href="wx.Object.html" title="wx.Object" alt="" coords="5,5,87,35"/> <area shape="rect" id="node3" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="112,5,213,35"/> <area shape="rect" id="node4" href="wx.SplitterWindow.html" title="wx.SplitterWindow" alt="" coords="37,237,171,267"/> </map> 
   </p>

|


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

================================================================================ ================================================================================
:meth:`~wx.SplitterWindow.__init__`                                              Default constructor.
:meth:`~wx.SplitterWindow.Create`                                                Creation function, for two-step construction.
:meth:`~wx.SplitterWindow.GetClassDefaultAttributes`                             
:meth:`~wx.SplitterWindow.GetDefaultSashSize`                                    Returns the default sash size in pixels.
:meth:`~wx.SplitterWindow.GetMinimumPaneSize`                                    Returns the current minimum pane size (defaults to zero).
:meth:`~wx.SplitterWindow.GetSashGravity`                                        Returns the current sash gravity.
:meth:`~wx.SplitterWindow.GetSashPosition`                                       Returns the current sash position.
:meth:`~wx.SplitterWindow.GetSashSize`                                           Returns the default sash size in pixels or 0 if it is invisible.
:meth:`~wx.SplitterWindow.GetSplitMode`                                          Gets the split mode.
:meth:`~wx.SplitterWindow.GetWindow1`                                            Returns the left/top or only pane.
:meth:`~wx.SplitterWindow.GetWindow2`                                            Returns the right/bottom pane.
:meth:`~wx.SplitterWindow.Initialize`                                            Initializes the splitter window to have one pane.
:meth:`~wx.SplitterWindow.IsSashInvisible`                                       Returns ``True`` if the sash is invisible even when the window is split, ``False`` otherwise.
:meth:`~wx.SplitterWindow.IsSplit`                                               Returns ``True`` if the window is split, ``False`` otherwise.
:meth:`~wx.SplitterWindow.ReplaceWindow`                                         This function replaces one of the windows managed by the :ref:`wx.SplitterWindow`  with another one.
:meth:`~wx.SplitterWindow.SetMinimumPaneSize`                                    Sets the minimum pane size.
:meth:`~wx.SplitterWindow.SetSashGravity`                                        Sets the sash gravity.
:meth:`~wx.SplitterWindow.SetSashInvisible`                                      Sets whether the sash should be invisible, even when the window is split.
:meth:`~wx.SplitterWindow.SetSashPosition`                                       Sets the sash position.
:meth:`~wx.SplitterWindow.SetSashSize`                                           Returns the default sash size in pixels or 0 if it is invisible.
:meth:`~wx.SplitterWindow.SetSplitMode`                                          Sets the split mode.
:meth:`~wx.SplitterWindow.SplitHorizontally`                                     Initializes the top and bottom panes of the splitter window.
:meth:`~wx.SplitterWindow.SplitVertically`                                       Initializes the left and right panes of the splitter window.
:meth:`~wx.SplitterWindow.Unsplit`                                               Unsplits the window.
:meth:`~wx.SplitterWindow.UpdateSize`                                            Causes any pending sizing of the sash and child panes to take place immediately.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.SplitterWindow.DefaultSashSize`                                       See :meth:`~wx.SplitterWindow.GetDefaultSashSize`
:attr:`~wx.SplitterWindow.MinimumPaneSize`                                       See :meth:`~wx.SplitterWindow.GetMinimumPaneSize` and :meth:`~wx.SplitterWindow.SetMinimumPaneSize`
:attr:`~wx.SplitterWindow.SashGravity`                                           See :meth:`~wx.SplitterWindow.GetSashGravity` and :meth:`~wx.SplitterWindow.SetSashGravity`
:attr:`~wx.SplitterWindow.SashInvisible`                                         See :meth:`~wx.SplitterWindow.IsSashInvisible` and :meth:`~wx.SplitterWindow.SetSashInvisible`
:attr:`~wx.SplitterWindow.SashPosition`                                          See :meth:`~wx.SplitterWindow.GetSashPosition` and :meth:`~wx.SplitterWindow.SetSashPosition`
:attr:`~wx.SplitterWindow.SashSize`                                              See :meth:`~wx.SplitterWindow.GetSashSize` and :meth:`~wx.SplitterWindow.SetSashSize`
:attr:`~wx.SplitterWindow.SplitMode`                                             See :meth:`~wx.SplitterWindow.GetSplitMode` and :meth:`~wx.SplitterWindow.SetSplitMode`
:attr:`~wx.SplitterWindow.Window1`                                               See :meth:`~wx.SplitterWindow.GetWindow1`
:attr:`~wx.SplitterWindow.Window2`                                               See :meth:`~wx.SplitterWindow.GetWindow2`
================================================================================ ================================================================================


|


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


.. class:: wx.SplitterWindow(Window)

   **Possible constructors**::

       SplitterWindow()
       
       SplitterWindow(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize,
                      style=SP_3D, name="splitterWindow")
       
   
   This class manages up to two subwindows.



   .. method:: __init__(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **__init__** `(self)`
      
      Default constructor.                   
      
      
      
      
      **~~~**

      
      **__init__** `(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=SP_3D, name="splitterWindow")`
      
      Constructor for creating the window.                  
      
      
      
      
      :param `parent`: The parent of the splitter window.   
      :type `parent`: wx.Window
      :param `id`: The window identifier.   
      :type `id`: wx.WindowID
      :param `pos`: The window position.   
      :type `pos`: wx.Point
      :param `size`: The window size.   
      :type `size`: wx.Size
      :param `style`: The window style. See :ref:`wx.SplitterWindow`.   
      :type `style`: long
      :param `name`: The window name.  
      :type `name`: string
      
      
      
      
      
      
      
      
      
      
      
      
      
      
                        
      
      
      
      .. note:: 
      
         After using this constructor, you must create either one or two subwindows with the splitter window as parent, and then call one of :ref:`wx.Initialize`, :meth:`SplitVertically`   and :meth:`SplitHorizontally`   in order to set the pane(s). You can create two windows, with one hidden when not being shown; or you can create and delete the second pane on demand.  
      
      
      
      
      
      
      
      .. seealso:: :ref:`wx.Initialize`, :meth:`SplitVertically` , :meth:`SplitHorizontally` , :meth:`Create`     
      
      
      
      
      
      
      
      **~~~**






   .. method:: Create(self, parent, id=ID_ANY, point=DefaultPosition, size=DefaultSize, style=SP_3D, name="splitter")

      Creation function, for two-step construction.                  

      See :ref:`wx.SplitterWindow`  for details.                  


      :param `parent`: 
      :type `parent`: wx.Window
      :param `id`: 
      :type `id`: wx.WindowID
      :param `point`: 
      :type `point`: wx.Point
      :param `size`: 
      :type `size`: wx.Size
      :param `style`: 
      :type `style`: long
      :param `name`: 
      :type `name`: string




      :rtype: `bool`








   .. staticmethod:: GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)




      :param `variant`: 
      :type `variant`: wx.WindowVariant




      :rtype: :ref:`wx.VisualAttributes`








   .. method:: GetDefaultSashSize(self)

      Returns the default sash size in pixels.                  

      The size of the sash is its width for a vertically split window and its height for a horizontally split one. Its other direction is the same as the client size of the window in the corresponding direction. 

      The default sash size is platform-dependent because it conforms to the current platform look-and-feel and cannot be changed. 

                

      :rtype: `int`







      .. versionadded:: 2.9.4 
     








   .. method:: GetMinimumPaneSize(self)

      Returns the current minimum pane size (defaults to zero).                  

                

      :rtype: `int`







      .. seealso:: :meth:`SetMinimumPaneSize`     








   .. method:: GetSashGravity(self)

      Returns the current sash gravity.                  

                

      :rtype: `float`







      .. seealso:: :meth:`SetSashGravity`     








   .. method:: GetSashPosition(self)

      Returns the current sash position.                  

                

      :rtype: `int`







      .. seealso:: :meth:`SetSashPosition`     








   .. method:: GetSashSize(self)

      Returns the default sash size in pixels or 0 if it is invisible.                  

                

      :rtype: `int`







      .. seealso:: :meth:`GetDefaultSashSize` , :meth:`IsSashInvisible` , :meth:`SetSashSize`     








   .. method:: GetSplitMode(self)

      Gets the split mode.                  

                

      :rtype: :ref:`wx.SplitMode`







      .. seealso:: :meth:`SetSplitMode` , :meth:`SplitVertically` , :meth:`SplitHorizontally` .   








   .. method:: GetWindow1(self)

      Returns the left/top or only pane.                  

      :rtype: :ref:`wx.Window`








   .. method:: GetWindow2(self)

      Returns the right/bottom pane.                  

      :rtype: :ref:`wx.Window`








   .. method:: Initialize(self, window)

      Initializes the splitter window to have one pane.                  

      The child window is shown if it is currently hidden. 




      :param `window`: The pane for the unsplit window.  
      :type `window`: wx.Window




                  



      .. note:: 

         This should be called if you wish to initially view only a single pane in the splitter window.  







      .. seealso:: :meth:`SplitVertically` , :meth:`SplitHorizontally`     








   .. method:: IsSashInvisible(self)

      Returns ``True`` if the sash is invisible even when the window is split, ``False`` otherwise.                  

                

      :rtype: `bool`







      .. versionadded:: 2.9.4 
     







      .. note:: 

         This is a shortcut for HasFlag(wxSP_NOSASH)  







      .. seealso:: :meth:`SetSashInvisible`   








   .. method:: IsSplit(self)

      Returns ``True`` if the window is split, ``False`` otherwise.                  

      :rtype: `bool`








   .. method:: ReplaceWindow(self, winOld, winNew)

      This function replaces one of the windows managed by the :ref:`wx.SplitterWindow`  with another one.                  

      It is in general better to use it instead of calling :meth:`Unsplit`   and then resplitting the window back because it will provoke much less flicker (if any). It is valid to call this function whether the splitter has two windows or only one. 

      Both parameters should be non-NULL and `winOld`  must specify one of the windows managed by the splitter. If the parameters are incorrect or the window couldn't be replaced, ``False`` is returned. Otherwise the function will return ``True``, but please notice that it will not delete the replaced window and you may wish to do it yourself. 

                


      :param `winOld`: 
      :type `winOld`: wx.Window
      :param `winNew`: 
      :type `winNew`: wx.Window




      :rtype: `bool`







      .. seealso:: :meth:`GetMinimumPaneSize`     








   .. method:: SetMinimumPaneSize(self, paneSize)

      Sets the minimum pane size.                  




      :param `paneSize`: Minimum pane size in pixels.  
      :type `paneSize`: int




                  



      .. note:: 

         The default minimum pane size is zero, which means that either pane can be reduced to zero by dragging the sash, thus removing one of the panes. To prevent this behaviour (and veto out-of-range sash dragging), set a minimum size, for example 20 pixels. If the ``wx.SP_PERMIT_UNSPLIT`` style is used when a splitter window is created, the window may be unsplit even if minimum size is non-zero.  







      .. seealso:: :meth:`GetMinimumPaneSize`     








   .. method:: SetSashGravity(self, gravity)

      Sets the sash gravity.                  




      :param `gravity`: The sash gravity. Value between 0.0 and 1.0.  
      :type `gravity`: float




                  



      .. note:: 

         Gravity is real factor which controls position of sash while resizing :ref:`wx.SplitterWindow`. Gravity tells :ref:`wx.SplitterWindow`  how much will left/top window grow while resizing. Example values:

         - 0.0: only the bottom/right window is automatically resized 
         - 0.5: both windows grow by equal size 
         - 1.0: only left/top window grows Gravity should be a real value between 0.0 and 1.0. Default value of sash gravity is 0.0. That value is compatible with previous (before gravity was introduced) behaviour of :ref:`wx.SplitterWindow`. 










      .. seealso:: :meth:`GetSashGravity`     








   .. method:: SetSashInvisible(self, invisible=True)

      Sets whether the sash should be invisible, even when the window is split.                  

      When the sash is invisible, it doesn't appear on the screen at all and, in particular, doesn't allow the user to resize the windows. 




      :param `invisible`: If ``True``, the sash is always invisible, else it is shown when the window is split.  
      :type `invisible`: bool




                  



      .. versionadded:: 2.9.4 
     







      .. note:: 

         Only sets the internal variable; does not update the display.  







      .. seealso:: :meth:`IsSashInvisible`   








   .. method:: SetSashPosition(self, position, redraw=True)

      Sets the sash position.                  




      :param `position`: The sash position in pixels.   
      :type `position`: int
      :param `redraw`: If ``True``, resizes the panes and redraws the sash and border.  
      :type `redraw`: bool






                  



      .. note:: 

         Does not currently check for an out-of-range value.  







      .. seealso:: :meth:`GetSashPosition`     








   .. method:: SetSashSize(self, size)

      Returns the default sash size in pixels or 0 if it is invisible.                  

                


      :param `size`: 
      :type `size`: int






      .. seealso:: :meth:`GetDefaultSashSize` , :meth:`GetSashSize` , :meth:`IsSashInvisible`     








   .. method:: SetSplitMode(self, mode)

      Sets the split mode.                  




      :param `mode`: Can be ``wx.SPLIT_VERTICAL`` or ``wx.SPLIT_HORIZONTAL``.  
      :type `mode`: int




                  



      .. note:: 

         Only sets the internal variable; does not update the display.  







      .. seealso:: :meth:`GetSplitMode` , :meth:`SplitVertically` , :meth:`SplitHorizontally` .   








   .. method:: SplitHorizontally(self, window1, window2, sashPosition=0)

      Initializes the top and bottom panes of the splitter window.                  

      The child windows are shown if they are currently hidden. 




      :param `window1`: The top pane.   
      :type `window1`: wx.Window
      :param `window2`: The bottom pane.   
      :type `window2`: wx.Window
      :param `sashPosition`: The initial position of the sash. If this value is positive, it specifies the size of the upper pane. If it is negative, its absolute value gives the size of the lower pane. Finally, specify 0 (default) to choose the default position (half of the total window height).  
      :type `sashPosition`: int










      :rtype: `bool`



                  



      :returns: 

         ``True`` if successful, ``False`` otherwise (the window was already split).  







      .. note:: 

         This should be called if you wish to initially view two panes. It can also be called at any subsequent time, but the application should check that the window is not currently split using :meth:`IsSplit` .  







      .. seealso:: :meth:`SplitVertically` , :meth:`IsSplit` , :meth:`Unsplit`     








   .. method:: SplitVertically(self, window1, window2, sashPosition=0)

      Initializes the left and right panes of the splitter window.                  

      The child windows are shown if they are currently hidden. 




      :param `window1`: The left pane.   
      :type `window1`: wx.Window
      :param `window2`: The right pane.   
      :type `window2`: wx.Window
      :param `sashPosition`: The initial position of the sash. If this value is positive, it specifies the size of the left pane. If it is negative, it is absolute value gives the size of the right pane. Finally, specify 0 (default) to choose the default position (half of the total window width).  
      :type `sashPosition`: int










      :rtype: `bool`



                  



      :returns: 

         ``True`` if successful, ``False`` otherwise (the window was already split).  







      .. note:: 

         This should be called if you wish to initially view two panes. It can also be called at any subsequent time, but the application should check that the window is not currently split using :meth:`IsSplit` .  







      .. seealso:: :meth:`SplitHorizontally` , :meth:`IsSplit` , :meth:`Unsplit` .   








   .. method:: Unsplit(self, toRemove=None)

      Unsplits the window.                  




      :param `toRemove`: The pane to remove, or ``None`` to remove the right or bottom pane.  
      :type `toRemove`: wx.Window






      :rtype: `bool`



                  



      :returns: 

         ``True`` if successful, ``False`` otherwise (the window was not split).  







      .. note:: 

         This call will not actually delete the pane being removed; it calls :meth:`OnUnsplit`   which can be overridden for the desired behaviour. By default, the pane being removed is hidden.  







      .. seealso:: :meth:`SplitHorizontally` , :meth:`SplitVertically` , :meth:`IsSplit` , :meth:`OnUnsplit`     








   .. method:: UpdateSize(self)

      Causes any pending sizing of the sash and child panes to take place immediately.                  

      Such resizing normally takes place in idle time, in order to wait for layout to be completed. However, this can cause unacceptable flicker as the panes are resized after the window has been shown. To work around this, you can perform window layout (for example by sending a size event to the parent window), and then call this function, before showing the top-level window.                   





   .. attribute:: DefaultSashSize

      See :meth:`~wx.SplitterWindow.GetDefaultSashSize`


   .. attribute:: MinimumPaneSize

      See :meth:`~wx.SplitterWindow.GetMinimumPaneSize` and :meth:`~wx.SplitterWindow.SetMinimumPaneSize`


   .. attribute:: SashGravity

      See :meth:`~wx.SplitterWindow.GetSashGravity` and :meth:`~wx.SplitterWindow.SetSashGravity`


   .. attribute:: SashInvisible

      See :meth:`~wx.SplitterWindow.IsSashInvisible` and :meth:`~wx.SplitterWindow.SetSashInvisible`


   .. attribute:: SashPosition

      See :meth:`~wx.SplitterWindow.GetSashPosition` and :meth:`~wx.SplitterWindow.SetSashPosition`


   .. attribute:: SashSize

      See :meth:`~wx.SplitterWindow.GetSashSize` and :meth:`~wx.SplitterWindow.SetSashSize`


   .. attribute:: SplitMode

      See :meth:`~wx.SplitterWindow.GetSplitMode` and :meth:`~wx.SplitterWindow.SetSplitMode`


   .. attribute:: Window1

      See :meth:`~wx.SplitterWindow.GetWindow1`


   .. attribute:: Window2

      See :meth:`~wx.SplitterWindow.GetWindow2`

