fsleyes_widgets.bitmapradio

This module provides the BitmapRadioBox class, a radio control which uses bitmap toggle buttons.

class fsleyes_widgets.bitmapradio.BitmapRadioBox(parent, style=None)[source]

Bases: Panel

A radio control which displays a collection of wx.ToggleButton controls, each of which displays an image.

Each of these buttons corresponds to a mutually exclusive option - when the user clicks on a button, it is toggled on, and all of the others are toggled off.

For example, here is a BitmapRadioBox which allows the user to switch between view mode and edit mode:

When the user pushes a button, a EVT_BITMAP_RADIO_EVENT is generated.

Create a BitmapRadioBox.

Parameters:
  • parent – A parent window.

  • style – A combination of BMPRADIO_ALLOW_DESELECTED, and one of wx.HORIZONTAL (the default) or wx.VERTICAL, to control the button layout direction

property buttons

Returns a list containing the BitmapToggleButton instances. Used for testing.

AddChoice(selectedBmp, unselectedBmp=None, clientData=None)[source]

Add a button to this BitmapRadioBox.

Parameters:
  • selectedBmp – A wx.Bitmap to display on the button when it is selected.

  • unselectedBmp – Optional. A wx.Bitmap to display on the button when it is not selected.

  • clientData – Arbitrary data which is associated with the choice.

Clear()[source]

Remove all buttons from this BitmapRadioBox.

EnableChoice(index, enable=True)[source]

Enable or disable the button at the specified index.

DisableChoice(index=None)[source]

Disable the button at the specified index.

Set(bitmaps, clientData=None)[source]

Set all buttons at once.

Parameters:
  • bitmaps – A list of wx.Bitmap objects.

  • clientData – A list of arbitrary data to associate with each choice.

GetSelection()[source]

Returns the index of the curently selected choice.

SetSelection(index)[source]

Sets the current selection.

fsleyes_widgets.bitmapradio.BMPRADIO_ALLOW_DESELECTED = 1

Style flag which allows all buttons to be de-selected. If not specified (the default), one button must always be selected.

fsleyes_widgets.bitmapradio.EVT_BITMAP_RADIO_EVENT = <wx.core.PyEventBinder object>

Identifier for the BitmapRadioEvent.

fsleyes_widgets.bitmapradio.BitmapRadioEvent

Event emitted when the user changes the radio selection. Contains the following attributes:

  • index: The index of the new selection.

  • clientData: Client data associated with the new selection.

  • value: False if BMPRADIO_ALLOW_DESELECTED is active,

    and the selected button was clicked on (thus deselecting it), True otherwise.