fsleyes_widgets.colourbutton

This module provides the ColourButton class, a button which allows the user to select a RGBA colour.

class fsleyes_widgets.colourbutton.ColourButton(parent, size=None, colour=None)[source]

Bases: Button

A wx.Button which allows the user to select a colour.

The currently selected colour is displayed as a bitmap on the button. When the user presses the button, a wx.ColourDialog is displayed, allowing the user to change the colour. When the user does so, a EVT_COLOUR_BUTTON_EVENT is generated.

This class provides an alternative to the wx.ColourPickerCtrl, which is a bit inflexible w.r.t. sizing/automatic resizing.

Create a ColourButton.

Parameters:
  • parent – A wx parent window.

  • size – A tuple containing the (width, height) of the colour bitmap in pixels. Defaults to (32, 32).

  • colour – Initial colour. Defaults to black.

GetValue()[source]

Return the current colour, as a tuple of (r, g, b, a) values, each in the range [0 - 255].

SetValue(colour)[source]

Sets the current colour to the specified colour.

fsleyes_widgets.colourbutton.EVT_COLOUR_BUTTON_EVENT = <wx.core.PyEventBinder object>

Identifier for the ColourButtonEvent.

fsleyes_widgets.colourbutton.ColourButtonEvent

Event emitted by a ColourButton when the user changes the selected colour.