fsleyes_widgets.togglepanel

This module provides the TogglePanel class, which is a panel that contains a button and some content. Pushing the button toggles the visibility of the content.

class fsleyes_widgets.togglepanel.TogglePanel(parent, toggleSide=64, initialState=True, label=None)[source]

Bases: Panel

A TogglePanel is a wx.Panel that contains a button and some content.

Pushing the button toggles the visibility of the content.

All of the content should be added to the panel which is returned by the GetPane() method.

The TogglePanel may be used in place of the wx.CollapsiblePane, which is buggy under Linux/GTK.

Create a TogglePanel.

Parameters:
  • parent – The wx parent object.

  • toggleSide – Which side to place the toggle button. Must be one of wx.TOP, wx.BOTTOM, wx.LEFT, or wx.RIGHT.

  • initialState – Initial state for the panel content - visible (True) or hidden (False).

  • label – A label to be displayed on the toggle button.

property button

Returns the toggle button (actually a wx.StaticText). This is for testing purposes.

SetLabel(label)[source]

Sets the label to show on the toggle button. Pass in None for no label.

GetLabel()[source]

Returns the current toggle button label

GetToggleButton()[source]

Returns the toggle button (actually a wx.StaticText). This is for testing purposes.

Expand(expand=True)[source]

Expand the content pane.

Parameters:

expandTrue to expand, False to collapse.

Collapse()[source]

Collapse the content pane.

IsExpanded()[source]

Return True if the content pane is currently expanded, False otherwise.

Toggle(ev=None)[source]

Toggles visibility of the panel content.

This method is called when the button is pushed. If ev is not None, an EVT_TOGGLEPANEL_EVENT is generated.

GetPane()[source]

Returns the wx.Panel to which all content should be added.

fsleyes_widgets.togglepanel.EVT_TOGGLEPANEL_EVENT = <wx.core.PyEventBinder object>

Identifier for the TogglePanelEvent event.

fsleyes_widgets.togglepanel.TogglePanelEvent

Event emitted when the toggle button is pushed. Contains the following attributes:

  • newState: The new visibility state of the toggle panel - True

    corresponds to visible, False to invisible.