class Button(Control)

A Button is a momentary-action pushbutton, invoking an action when it is clicked.

Constructors

Button(title)

Creates a generic pushbutton with the given title.

DefaultButton(title = "OK", style = 'default', action = 'default_action')
CancelButton(title = "Cancel", style = 'cancel', action = 'cancel_action')

These create buttons with the appropriate appearance and behaviour for use as OK or Cancel buttons in a dialog box. By default, when used in a modal dialog, the DefaultButton will dismiss the dialog with the value True, and the CancelButton will dismiss it with the value False. These actions can also be invoked with the Return/Enter and Escape keys. See Dialog and ModalDialog for more information.

Properties

title
Title string to display inside the button.

style
One of 'normal', 'default' or 'cancel'. Setting this to 'default' or 'cancel causes the button to take on the appearance of a default button or a cancel button respectively, according to platform conventions. (This property only affects the appearance of the button, it does not automatically make the button respond to keyboard commands.)

Action Properties

action
Action to perform when the button is clicked. See Actions.

Methods

activate()
Animates a simulation of the button being pressed momentarily, and then invokes its action.