wx.CollapsiblePane

Inheritance diagram for wx.CollapsiblePane:



Description

A collapsible pane is a container with an embedded button-like control which can be used by the user to collapse or expand the pane’s contents.

Once constructed you should use the GetPane function to access the pane and add your controls inside it (i.e. use the GetPane ‘s returned pointer as parent for the controls which must go in the pane, NOT the wx.CollapsiblePane itself!).

Note that because of its nature of control which can dynamically (and drastically) change its size at run-time under user-input, when putting wx.CollapsiblePane inside a wx.Sizer you should be careful to add it with a proportion value of zero; this is because otherwise all other windows with non-null proportion values would automatically get resized each time the user expands or collapse the pane window resulting usually in a weird, flickering effect.

For example:

# Create a wx.CollapsiblePane widget
collpane = wx.CollapsiblePane(self, wx.ID_ANY, "Details:")

# Add the pane with a zero proportion value to the 'sz' sizer
# which contains it
sz.Add(collpane, 0, wx.GROW|wx.ALL, 5)

# Now add a test label in the collapsible pane using a sizer to layout it:
win = collpane.GetPane()
paneSz = wx.BoxSizer(wx.VERTICAL)
paneSz.Add(wx.StaticText(win, wx.ID_ANY, "test"), 1, wx.GROW|wx.ALL, 2)
win.SetSizer(paneSz)
paneSz.SetSizeHints(win)

Window Styles

Window Style Description
wx.CP_DEFAULT_STYLE The default style: 0.

Event Handling

Event Name Description
wx.EVT_COLLAPSIBLEPANE_CHANGED(id, func) The user showed or hidden the collapsible pane.

Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


Properties Summary

Class API

Methods

__init__(parent, winid=-1, label="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.CP_DEFAULT_STYLE, val=wx.DefaultValidator, name=wx.CollapsiblePaneNameStr)

Create and show a wx.CollapsiblePane.

Parameters:


Returns:

wx.CollapsiblePane


Collapse()
Collapses or expands the pane window.

Expand()
Same as Collapse (False).

GetPane()

Returns a pointer to the pane window. Add controls to the returned wx.Window to make them collapsible.


Returns:

wx.Window


IsCollapsed()

Returns True if the pane window is currently hidden.


Returns:

bool


IsExpanded()

Returns True if the pane window is currently shown.


Returns:

bool


Properties

Collapsed
Returns True if the pane window is currently hidden.
Expanded
Returns True if the pane window is currently shown.