AGW Logo

agw_title PyCollapsiblePane

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.

hierarchy Inheritance Diagram

Inheritance diagram for: PyCollapsiblePane

Inheritance diagram of PyCollapsiblePane


appearance Control Appearance


PyCollapsiblePane

PyCollapsiblePane


method_summary Methods Summary

__init__Default class constructor.
CollapseCollapses or expands the pane window.
DoGetBestSizeGets the size which best suits the window: for a control, it would be the
ExpandSame as Collapse (False).
GetAGWWindowStyleFlagReturns the PyCollapsiblePane window style.
GetBorderReturns the PyCollapsiblePane border in pixels (platform dependent).
GetBtnLabelReturns the button label.
GetButtonReturns the button associated with PyCollapsiblePane.
GetButtonFontReturns the button font.
GetExpanderDimensionsReturns the expander dimensions, a tuple of integers representing the
GetLabelReturns the button label.
GetPaneReturns a reference to the pane window.
HasAGWFlagReturns whether a flag is present in the PyCollapsiblePane style.
IsCollapsedReturns True if the pane window is currently hidden.
IsExpandedReturns True if the pane window is currently shown.
LayoutLayout the PyCollapsiblePane.
OnButtonHandles the wx.EVT_BUTTON event for PyCollapsiblePane.
OnDrawGTKExpanderOverridable method to draw the GTK-style expander.
OnDrawGTKStyleHandles the wx.EVT_PAINT event for PyCollapsiblePane.
OnDrawGTKTextOverridable method to draw the PyCollapsiblePane text in the expander.
OnSizeHandles the wx.EVT_SIZE event for PyCollapsiblePane.
OnStateChangeHandles the status changes (collapsing/expanding).
SetAGWWindowStyleFlagSets the PyCollapsiblePane window style flags.
SetButtonAssign a new button to PyCollapsiblePane.
SetButtonFontSets the button font.
SetExpanderDimensionsSets the expander width and height.
SetLabelSets the button label.

API Class API

class PyCollapsiblePane(wx.PyPanel)[source]

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.



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

Default class constructor.

Parameters:
  • parent – the PyCollapsiblePane parent. Must not be None;
  • id – window identifier. A value of -1 indicates a default value;
  • label – The initial label shown in the button which allows the user to expand or collapse the pane window.
  • 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-specifi window style. This can be a combination of the following bits:


    Window Styles Hex Value Description
    CP_NO_TLW_RESIZE 0x2 By default 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 wx.StaticBox around PyCollapsiblePane.
    CP_LINE_ABOVE 0x10 Draws a line above PyCollapsiblePane.
  • validator – the validator associated to the PyCollapsiblePane;
  • name – the widget name.


Collapse(collapse=True)[source]

Collapses or expands the pane window.

Parameters:collapseTrue to collapse the pane window, False to expand it.


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.



Expand()[source]

Same as Collapse (False).



GetAGWWindowStyleFlag()[source]

Returns the PyCollapsiblePane window style.

See also

SetAGWWindowStyleFlag for a list of possible window style flags.



GetBorder()[source]

Returns the PyCollapsiblePane border in pixels (platform dependent).



GetBtnLabel()[source]

Returns the button label.



GetButton()[source]

Returns the button associated with PyCollapsiblePane.



GetButtonFont()[source]

Returns the button font.



GetExpanderDimensions()[source]

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



GetLabel()[source]

Returns the button label.

Note

Overridden from wx.PyPanel.



GetPane()[source]

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



HasAGWFlag(flag)[source]

Returns whether a flag is present in the PyCollapsiblePane style.

Parameters:flag – one of the possible PyCollapsiblePane window styles.

See also

SetAGWWindowStyleFlag for a list of possible window style flags.



IsCollapsed()[source]

Returns True if the pane window is currently hidden.



IsExpanded()[source]

Returns True if the pane window is currently shown.



Layout()[source]

Layout the PyCollapsiblePane.



OnButton(event)[source]

Handles the wx.EVT_BUTTON event for PyCollapsiblePane.

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


OnDrawGTKExpander(dc)[source]

Overridable method to draw the GTK-style expander.

Parameters:dc – an instance of wx.DC.


OnDrawGTKStyle(event)[source]

Handles the wx.EVT_PAINT event for PyCollapsiblePane.

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

Note

This is a drawing routine to paint the GTK-style expander.



OnDrawGTKText(dc)[source]

Overridable method to draw the PyCollapsiblePane text in the expander.

Parameters:dc – an instance of wx.DC.



OnSize(event)[source]

Handles the wx.EVT_SIZE event for PyCollapsiblePane.

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


OnStateChange(sz)[source]

Handles the status changes (collapsing/expanding).

Parameters:sz – an instance of wx.Size.


SetAGWWindowStyleFlag(agwStyle)[source]

Sets the PyCollapsiblePane window style flags.

Parameters: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 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 wx.StaticBox around PyCollapsiblePane.
CP_LINE_ABOVE 0x10 Draws a line above PyCollapsiblePane.


SetButton(button)[source]

Assign a new button to PyCollapsiblePane.

Parameters:button – can be the standard wx.Button or any of the generic implementations which live in wx.lib.buttons.


SetButtonFont(font)[source]

Sets the button font.

Parameters:font – a valid wx.Font object.


SetExpanderDimensions(width, height)[source]

Sets the expander width and height.

Parameters:
  • width – an integer specifying the expander width in pixels;
  • height – an integer specifying the expander height in pixels.


SetLabel(label)[source]

Sets the button label.

Parameters:label – the new button label.

Note

Overridden from wx.PyPanel.

Tree

Table Of Contents

Previous topic

GTKExpander

Next topic

SVN Revision 68362 For pycollapsiblepane