class controls.Button(ButtonBase, Label)

A Button is a widget with a textual label which can be clicked with the mouse to trigger an action.

Constructor

Button(text, action = None, enable = None)
Initializes the button with the given text. The action should be a function of no arguments; it will be called when the mouse is clicked and released again inside the button. If supplied, enable should be a function returning a boolean; it will be used to determine whether the button is enabled.

Theme Properties

highlight_color
Colour in which to display the text while mouse has been clicked but not yet released.
disabled_color
Colour in which to display the text when the widget is disabled.

highlight_bg_color
Colour with which to fill the background when the widget is highlighted.

enabled_bg_color
Colour with which to fill the background when the widget is enabled.

disabled_bg_color
Colour with which to fill the background when the widget is disabled.

Properties

enabled
True if the button is enabled. If no enable function was supplied in the constructor, this property may also be assigned in order to enable and disable the button.
---