fsleyes_widgets.notebook

This module provides the Notebook class, a notebook control similar to the wx.Notebook.

class fsleyes_widgets.notebook.Notebook(parent, style=None, border=5)[source]

Bases: Panel

A wx.Panel which provides wx.Notebook-like functionality. Manages the display of multiple child windows. A row of buttons along one side allows the user to select which child window to display.

This Notebook implementation supports page enabling/disabling, and toggling of page visibility.

Create a Notebook object.

The side on which the notebook page buttons will be displayed can be controlled by setting one of wx.TOP (the default), wx.BOTTOM, wx.LEFT, or wx.RIGHT on the style flags.

The orientation of the page buttons can be set to either horizontal (the default) or vertical by setting one of wx.HORIZONTAL or wx.VERTICAL on the style flags.

Parameters:
  • parent – The wx parent object.

  • style – Passed to wx.Panel.__init__. If not provided, defaults to wx.TOP | wx.HORIZONTAL | wx.SUNKEN_BORDER.

  • border – Border (in pixels) around pages. Defaults to 5.

property pages

Returns a list containing references to all of the pages in this Notebook.

property buttons

Returns a list containing references to all of the page buttons in this Notebook.

SetButtonColours(**kwargs)[source]

Set the colours used for the notebook page buttons. Set any colour to None to use the default colours. All arguments must be passed as keyword arguments.

Parameters:
  • text – Text colour

  • disabledText – Text colour for disabled pages.

  • default – Default (unselected) background colour.

  • selected – Selected background colour.

PageCount()[source]

Returns the number of pages in this Notebook.

FindPage(page)[source]

Returns the index of the given page, or wx.NOT_FOUND if the page is not in this notebook.

InsertPage(index, page, text)[source]

Inserts the given page into the notebook at the specified index. A button for the page is also added to the button row, with the specified text.

AddPage(page, text)[source]

Adds the given page (and a corresponding button with the given text) to the end of the notebook.

RemovePage(index)[source]

Removes the page at the specified index, but does not destroy it.

DeletePage(index)[source]

Removes the page at the specified index, and (attempts to) destroy it.

GetSelection()[source]

Returns the index of the currently selected page, or None if there are no pages.

SetSelection(index)[source]

Sets the displayed page to the one at the specified index.

AdvanceSelection(forward=True)[source]

Selects the next (or previous, if forward is False) enabled page.

EnablePage(index)[source]

Enables the page at the specified index.

DisablePage(index)[source]

Disables the page at the specified index.

ShowPage(index)[source]

Shows the page at the specified index.

HidePage(index)[source]

Hides the page at the specified index.

fsleyes_widgets.notebook.EVT_PAGE_CHANGE = <wx.core.PyEventBinder object>

Identifier for the PageChangeEvent event.

fsleyes_widgets.notebook.PageChangeEvent

Event emitted when the page is changed by the user. A PageChangeEvent has the following attributes:

  • index The index of the page that was selected.