***************** wx.SplitterWindow ***************** Inheritance diagram for `wx.SplitterWindow`: | .. inheritance-diagram:: wx.SplitterWindow | Description =========== 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 `wx.SplitterWindow` user interface. .. seealso:: `wx.SplitterEvent <../Events/wx.SplitterEvent.html>`_ Derived From ^^^^^^^^^^^^^ * `wx.Window `_ * `wx.EvtHandler `_ * `wx.Object `_ Window Styles ^^^^^^^^^^^^^ ================================================== ================================================== Window Style Description ================================================== ================================================== ``wx.SP_3D`` Draws a 3D effect border and sash. ``wx.SP_3DSASH`` Draws a 3D effect sash. ``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 XOR line but resize the child windows immediately ================================================== ================================================== Event Handling ^^^^^^^^^^^^^^ ================================================== ================================================== Event Name Description ================================================== ================================================== wx.EVT_SPLITTER_SASH_POS_CHANGING(id, func) 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 ``wx.wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING`` event. wx.EVT_SPLITTER_SASH_POS_CHANGED(id, func) 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 ``wx.wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED`` event. wx.EVT_SPLITTER_UNSPLIT(id, func) The splitter has been just unsplit. Processes a ``wx.wxEVT_COMMAND_SPLITTER_UNSPLIT`` event. wx.EVT_SPLITTER_DCLICK(id, func) 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 ``wx.wxEVT_COMMAND_SPLITTER_DOUBLECLICKED`` event. ================================================== ================================================== Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `GetBorderSize <#GetBorderSize>`_ * `GetMinimumPaneSize <#GetMinimumPaneSize>`_ * `GetNeedUpdating <#GetNeedUpdating>`_ * `GetSashGravity <#GetSashGravity>`_ * `GetSashPosition <#GetSashPosition>`_ * `GetSashSize <#GetSashSize>`_ * `GetSplitMode <#GetSplitMode>`_ * `GetWindow1 <#GetWindow1>`_ * `GetWindow2 <#GetWindow2>`_ * `Initialize <#Initialize>`_ * `IsSplit <#IsSplit>`_ * `ReplaceWindow <#ReplaceWindow>`_ * `SashHitTest <#SashHitTest>`_ * `SetBorderSize <#SetBorderSize>`_ * `SetMinimumPaneSize <#SetMinimumPaneSize>`_ * `SetNeedUpdating <#SetNeedUpdating>`_ * `SetSashGravity <#SetSashGravity>`_ * `SetSashPosition <#SetSashPosition>`_ * `SetSashSize <#SetSashSize>`_ * `SetSplitMode <#SetSplitMode>`_ * `SizeWindows <#SizeWindows>`_ * `SplitHorizontally <#SplitHorizontally>`_ * `SplitVertically <#SplitVertically>`_ * `Unsplit <#Unsplit>`_ * `UpdateSize <#UpdateSize>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `BorderSize <#BorderSize>`_ * `MinimumPaneSize <#MinimumPaneSize>`_ * `NeedUpdating <#NeedUpdating>`_ * `SashGravity <#SashGravity>`_ * `SashPosition <#SashPosition>`_ * `SashSize <#SashSize>`_ * `SplitMode <#SplitMode>`_ * `Window1 <#Window1>`_ * `Window2 <#Window2>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.SP_3D, name=wx.SplitterNameStr) Constructor. Creates and shows a `wx.SplitterWindow`. **Parameters:** * `parent` (`wx.Window `_) * `id` (int) * `pos` (`wx.Point `_) * `size` (`wx.Size `_) * `style` (long) * `name` (string) | **Returns:** `wx.SplitterWindow `_ .. note:: After using this constructor, you must create either one or two subwindows with the splitter window as parent, and then call one of `Initialize <#Initialize>`_, `SplitVertically <#SplitVertically>`_ or `SplitHorizontally <#SplitHorizontally>`_ in order to set the pane(s). -------- .. method:: GetBorderSize() Gets the border size | **Returns:** `int` -------- .. method:: GetMinimumPaneSize() Returns the current minimum pane size (defaults to zero). | **Returns:** `int` .. seealso:: `SetMinimumPaneSize <#SetMinimumPaneSize>`_ -------- .. method:: GetNeedUpdating() `No docstrings available for this method.` -------- .. method:: GetSashGravity() Returns the current sash gravity. | **Returns:** `double` .. seealso:: `SetSashGravity <#SetSashGravity>`_ -------- .. method:: GetSashPosition() Returns the current sash position. | **Returns:** `int` .. seealso:: `SetSashPosition <#SetSashPosition>`_ -------- .. method:: GetSashSize() Gets the sash size | **Returns:** `int` -------- .. method:: GetSplitMode() Gets the split mode. | **Returns:** `int` .. seealso:: `SetSplitMode <#SetSplitMode>`_, `SplitVertically <#SplitVertically>`_, `SplitHorizontally <#SplitHorizontally>`_ -------- .. method:: GetWindow1() Returns the left/top or only pane. | **Returns:** `wx.Window `_ -------- .. method:: GetWindow2() Returns the right/bottom pane. | **Returns:** `wx.Window `_ -------- .. method:: Initialize(window) Initializes the splitter window to have one pane. The child window is shown if it is currently hidden. **Parameters:** * `window` (`wx.Window `_): The pane for the unsplit window. .. note:: This should be called if you wish to initially view only a single pane in the splitter window. .. seealso:: `SplitVertically <#SplitVertically>`_, `SplitHorizontally <#SplitHorizontally>`_ -------- .. method:: IsSplit() Returns ``True`` if the window is split, ``False`` otherwise. | **Returns:** `bool` -------- .. method:: ReplaceWindow(winOld, winNew) This function replaces one of the windows managed by the `wx.SplitterWindow` with another one. It is in general better to use it instead of calling `Unsplit() <#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 not ``None`` 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. **Parameters:** * `winOld` (`wx.Window `_) * `winNew` (`wx.Window `_) | **Returns:** `bool` .. seealso:: `GetMinimumPaneSize <#GetMinimumPaneSize>`_ -------- .. method:: SashHitTest(x, y, tolerance=5) Tests for `x`, `y` over the sash **Parameters:** * `x` (int) * `y` (int) * `tolerance` (int) | **Returns:** `bool` -------- .. method:: SetBorderSize(width) Sets the border size. Currently a NOP. **Parameters:** * `width` (int) -------- .. method:: SetMinimumPaneSize(min) Sets the minimum pane size. **Parameters:** * `min` (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:: `GetMinimumPaneSize <#GetMinimumPaneSize>`_ -------- .. method:: SetNeedUpdating(needUpdating) | **Parameters:** * `needUpdating` (bool) -------- .. method:: SetSashGravity(gravity) Sets the sash gravity. Example values: ================= ==================================== Sash Gravity Effect ================= ==================================== 0.0 Only the bottom or right window is automaticaly resized. 0.5 Both windows grow equally. 1.0 Only left/top window grows. ================= ==================================== | The default value of sash gravity is 0.0. That value is compatible with the previous (before gravity was introduced) behaviour of the `wx.SplitterWindow`. **Parameters:** * `gravity` (double): The sash gravity. Value between 0.0 and 1.0. .. seealso:: `GetSashGravity <#GetSashGravity>`_ -------- .. method:: SetSashPosition(position, redraw=True) Sets the sash position. **Parameters:** * `position` (int): The sash position in pixels. * `redraw` (bool): If ``True``, resizes the panes and redraws the sash and border. .. note:: This method does not currently check for an out-of-range value. .. seealso:: `GetSashPosition <#GetSashPosition>`_ -------- .. method:: SetSashSize(size) Sets the sash size. Normally, the sash size is determined according to the metrics of each platform, but the application can override this, for example to show a thin sash that the user is not expected to drag. If `size` is greater than -1, the custom sash size will be used. **Parameters:** * `size` (int) -------- .. method:: SetSplitMode(mode) Sets the split mode. **Parameters:** * `mode` (int): Can be ``wx.SPLIT_VERTICAL`` or ``wx.SPLIT_HORIZONTAL``. .. note:: Only sets the internal variable; does not update the display. .. seealso:: `GetSplitMode <#GetSplitMode>`_, `SplitVertically <#SplitVertically>`_, `SplitHorizontally <#SplitHorizontally>`_. -------- .. method:: SizeWindows() Resizes subwindows. -------- .. method:: SplitHorizontally(window1, window2, sashPosition=0) Initializes the top and bottom panes of the splitter window. The child windows are shown if they are currently hidden. **Parameters:** * `window1` (`wx.Window `_): The top pane. * `window2` (`wx.Window `_): The bottom pane. * `sashPosition` (int): 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). | **Returns:** `bool` .. 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 `IsSplit <#IsSplit>`_. .. seealso:: `SplitVertically <#SplitVertically>`_, `IsSplit <#IsSplit>`_, `Unsplit <#Unsplit>`_ -------- .. method:: SplitVertically(window1, window2, sashPosition=0) Initializes the left and right panes of the splitter window. The child windows are shown if they are currently hidden. **Parameters:** * `window1` (`wx.Window `_): The left pane. * `window2` (`wx.Window `_): The right pane. * `sashPosition` (int): 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). | **Returns:** `bool` .. 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 `IsSplit <#IsSplit>`_. .. seealso:: `SplitHorizontally <#SplitHorizontally>`_, `IsSplit <#IsSplit>`_, `Unsplit <#Unsplit>`_ -------- .. method:: Unsplit(toRemove=None) Unsplits the window. **Parameters:** * `toRemove` (`wx.Window `_): The pane to remove, or ``None`` to remove the right or bottom pane. | **Returns:** `bool` .. note:: This call will not actually delete the pane being removed; it calls `OnUnsplit` which can be overridden for the desired behaviour. By default, the pane being removed is hidden. .. seealso:: `SplitHorizontally <#SplitHorizontally>`_, `SplitVertically <#SplitVertically>`_, `IsSplit <#IsSplit>`_ -------- .. method:: UpdateSize() 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. -------- Properties ^^^^^^^^^^ .. attribute:: BorderSize See `GetBorderSize <#GetBorderSize>`_ and `SetBorderSize <#SetBorderSize>`_ .. attribute:: MinimumPaneSize See `GetMinimumPaneSize <#GetMinimumPaneSize>`_ and `SetMinimumPaneSize <#SetMinimumPaneSize>`_ .. attribute:: NeedUpdating See `GetNeedUpdating <#GetNeedUpdating>`_ and `SetNeedUpdating <#SetNeedUpdating>`_ .. attribute:: SashGravity See `GetSashGravity <#GetSashGravity>`_ and `SetSashGravity <#SetSashGravity>`_ .. attribute:: SashPosition See `GetSashPosition <#GetSashPosition>`_ and `SetSashPosition <#SetSashPosition>`_ .. attribute:: SashSize See `GetSashSize <#GetSashSize>`_ and `SetSashSize <#SetSashSize>`_ .. attribute:: SplitMode See `GetSplitMode <#GetSplitMode>`_ and `SetSplitMode <#SetSplitMode>`_ .. attribute:: Window1 See `GetWindow1 <#GetWindow1>`_ .. attribute:: Window2 See `GetWindow2 <#GetWindow2>`_