AGW Logo

agw_title FourWaySplitter

This class is very similar to wx.SplitterWindow except that it allows for four windows and two sashes. Many of the same styles, constants, and methods behave the same as in wx.SplitterWindow. However, in addition of the ability to drag the vertical and the horizontal sash, by dragging at the intersection between the two sashes, it is possible to resize the four windows at the same time.

Note

These things are not yet supported:

  • Minimum pane size (minimum of what? Width? Height?);
  • Using negative sash positions to indicate a position offset from the end;
  • User controlled unsplitting with double clicks on the sash (but supported via the SetExpanded method);
  • Sash gravity.

hierarchy Inheritance Diagram

Inheritance diagram for: FourWaySplitter

Inheritance diagram of FourWaySplitter


appearance Control Appearance


FourWaySplitter

FourWaySplitter


method_summary Methods Summary

__init__Default class constructor.
AdjustLayoutAdjust layout of FourWaySplitter. Mainly used to recalculate the
AppendWindowAdd a new window to the splitter at the right side or bottom of the window stack.
DetachWindowRemoves the window from the stack of windows managed by the splitter.
DoGetBestSizeGets the size which best suits the window: for a control, it would be the
DoSendChangingEventSends a EVT_SPLITTER_SASH_POS_CHANGING event.
DrawSplitterActually draws the sashes.
DrawTrackSplitterDraws a fake sash in case we don’t have wx.SP_LIVE_UPDATE style.
ExchangeWindowsTrade the positions in the splitter of the two windows.
GetAGWWindowStyleFlagReturns the FourWaySplitter window style.
GetBottomLeftReturns the bottom left window (window index: 2).
GetBottomRightReturns the bottom right window (window index: 3).
GetModeDetermines the split mode for FourWaySplitter.
GetTopLeftReturns the top left window (window index: 0).
GetTopRightReturns the top right window (window index: 1).
GetWindowReturns the window at the index idx.
InsertWindowInsert a new window into the splitter at the position given in idx.
MoveSplitMoves the split accordingly to user action.
OnEnterWindowHandles the wx.EVT_ENTER_WINDOW event for FourWaySplitter.
OnLeaveWindowHandles the wx.EVT_LEAVE_WINDOW event for FourWaySplitter.
OnLeftDownHandles the wx.EVT_LEFT_DOWN event for FourWaySplitter.
OnLeftUpHandles the wx.EVT_LEFT_UP event for FourWaySplitter.
OnMotionHandles the wx.EVT_MOTION event for FourWaySplitter.
OnPaintHandles the wx.EVT_PAINT event for FourWaySplitter.
OnSizeHandles the wx.EVT_SIZE event for FourWaySplitter.
ReplaceWindowReplaces oldWindow (which is currently being managed by the
SetAGWWindowStyleFlagSets the FourWaySplitter window style flags.
SetExpandedThis method is used to expand one of the four window to fill the whole client size (when expanded >= 0) or to return to the four-window view (when expanded < 0).
SetHSplitChange horizontal split fraction.
SetVSplitChange vertical split fraction.
_GetBorderSizeUsed internally.
_GetSashSizeUsed internally.
_RedrawIfHotSensitiveUsed internally.
_SizeWindowsRecalculate the layout based on split positions and split fractions.

API Class API

class FourWaySplitter(wx.PyPanel)[source]

This class is very similar to wx.SplitterWindow except that it allows for four windows and two sashes. Many of the same styles, constants, and methods behave the same as in wx.SplitterWindow. However, in addition of the ability to drag the vertical and the horizontal sash, by dragging at the intersection between the two sashes, it is possible to resize the four windows at the same time.

Note

These things are not yet supported:

  • Minimum pane size (minimum of what? Width? Height?);
  • Using negative sash positions to indicate a position offset from the end;
  • User controlled unsplitting with double clicks on the sash (but supported via the FourWaySplitter.SetExpanded() method);
  • Sash gravity.


__init__(parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=0, name="FourWaySplitter")[source]

Default class constructor.

Parameters:
  • parent – parent window. Must not be None;
  • id – window identifier. A value of -1 indicates a default value;
  • pos – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform;
  • size – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;
  • style – the underlying wx.PyPanel window style;
  • agwStyle – the AGW-specific window style. It can be a combination of the following bits:


    Window Styles Hex Value Description
    SP_NOSASH 0x10 No sash will be drawn on FourWaySplitter.
    SP_LIVE_UPDATE 0x80 Don’t draw XOR line but resize the child windows immediately.
    SP_3DBORDER 0x200 Draws a 3D effect border.
  • name – the window name.


AdjustLayout()[source]

Adjust layout of FourWaySplitter. Mainly used to recalculate the correct values for split fractions.



AppendWindow(window)[source]

Add a new window to the splitter at the right side or bottom of the window stack.

Parameters:window – an instance of wx.Window.


DetachWindow(window)[source]

Removes the window from the stack of windows managed by the splitter. The window will still exist so you should Hide or Destroy it as needed.

Parameters:window – an instance of wx.Window.



DoGetBestSize()[source]

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



DoSendChangingEvent(pt)[source]

Sends a EVT_SPLITTER_SASH_POS_CHANGING event.

Parameters:pt – the point at which the splitter is being positioned.


DrawSplitter(dc)[source]

Actually draws the sashes.

Parameters:dc – an instance of wx.DC.


DrawTrackSplitter(x, y)[source]

Draws a fake sash in case we don’t have wx.SP_LIVE_UPDATE style.

Parameters:
  • x – the x position of the sash;
  • y – the y position of the sash.

Note

This method relies on wx.ScreenDC which is currently unavailable on wxMac.



ExchangeWindows(window1, window2)[source]

Trade the positions in the splitter of the two windows.

Parameters:


GetAGWWindowStyleFlag()[source]

Returns the FourWaySplitter window style.

See also

SetAGWWindowStyleFlag for a list of possible window styles.



GetBottomLeft()[source]

Returns the bottom left window (window index: 2).



GetBottomRight()[source]

Returns the bottom right window (window index: 3).



GetMode(pt)[source]

Determines the split mode for FourWaySplitter.

Parameters:pt – the point at which the mouse has been clicked, an instance of wx.Point.
Returns:One of the following 3 split modes:
Split Mode Description
wx.HORIZONTAL the user has clicked on the horizontal sash
wx.VERTICAL The user has clicked on the vertical sash
wx.BOTH The user has clicked at the intersection between the 2 sashes


GetTopLeft()[source]

Returns the top left window (window index: 0).



GetTopRight()[source]

Returns the top right window (window index: 1).



GetWindow(idx)[source]

Returns the window at the index idx.

Parameters:idx – the index at which the window is located.


InsertWindow(idx, window, sashPos=-1)[source]

Insert a new window into the splitter at the position given in idx.

Parameters:
  • idx – the index at which the window will be inserted;
  • window – an instance of wx.Window;

  • sashPos – the sash position after the window insertion.


MoveSplit(x, y)[source]

Moves the split accordingly to user action.

Parameters:
  • x – the new splitter x coordinate;
  • y – the new splitter y coordinate.


OnEnterWindow(event)[source]

Handles the wx.EVT_ENTER_WINDOW event for FourWaySplitter.

Parameters:event – a wx.MouseEvent event to be processed.


OnLeaveWindow(event)[source]

Handles the wx.EVT_LEAVE_WINDOW event for FourWaySplitter.

Parameters:event – a wx.MouseEvent event to be processed.



OnLeftDown(event)[source]

Handles the wx.EVT_LEFT_DOWN event for FourWaySplitter.

Parameters:event – a wx.MouseEvent event to be processed.



OnLeftUp(event)[source]

Handles the wx.EVT_LEFT_UP event for FourWaySplitter.

Parameters:event – a wx.MouseEvent event to be processed.



OnMotion(event)[source]

Handles the wx.EVT_MOTION event for FourWaySplitter.

Parameters:event – a wx.MouseEvent event to be processed.



OnPaint(event)[source]

Handles the wx.EVT_PAINT event for FourWaySplitter.

Parameters:event – a wx.PaintEvent event to be processed.


OnSize(event)[source]

Handles the wx.EVT_SIZE event for FourWaySplitter.

Parameters:event – a wx.SizeEvent event to be processed.


ReplaceWindow(oldWindow, newWindow)[source]

Replaces oldWindow (which is currently being managed by the splitter) with newWindow. The oldWindow window will still exist so you should Hide or Destroy it as needed.

Parameters:


SetAGWWindowStyleFlag(agwStyle)[source]

Sets the FourWaySplitter window style flags.

Parameters:agwStyle – the AGW-specific window style. This can be a combination of the following bits:


Window Styles Hex Value Description
SP_NOSASH 0x10 No sash will be drawn on FourWaySplitter.
SP_LIVE_UPDATE 0x80 Don’t draw XOR line but resize the child windows immediately.
SP_3DBORDER 0x200 Draws a 3D effect border.


SetExpanded(expanded)[source]

This method is used to expand one of the four window to fill the whole client size (when expanded >= 0) or to return to the four-window view (when expanded < 0).

Parameters:expanded – an integer >= 0 to expand a window to fill the whole client size, or an integer < 0 to return to the four-window view.


SetHSplit(s)[source]

Change horizontal split fraction.

Parameters:s – the split fraction, which is an integer value between 0 and 10000 (inclusive), indicating how much space to allocate to the leftmost panes. For example, to split the panes at 35 percent, use:

fourSplitter.SetHSplit(3500)


SetVSplit(s)[source]

Change vertical split fraction.

Parameters:s – the split fraction, which is an integer value between 0 and 10000 (inclusive), indicating how much space to allocate to the topmost panes. For example, to split the panes at 35 percent, use:

fourSplitter.SetVSplit(3500)
Tree

Table Of Contents

Previous topic

fourwaysplitter

Next topic

FourWaySplitterEvent