traitsui.editors.button_editor module

Defines the button editor factory for all traits toolkit backends.

class traitsui.editors.button_editor.ButtonEditor(**traits)[source]

Bases: EditorFactory

Editor factory for buttons.

height_padding = Range(0, 31, 5)

Extra padding to add to both the top and the bottom sides

image = Image

(Optional) Image to display on the button

image_value = Str()

The name of the external object trait that the button image is synced to

label = Str()

Optional label for the button

label_value = Str()

The name of the external object trait that the button label is synced to

orientation = Enum("vertical", "horizontal")

Orientation of the text relative to the image

style = Enum("button", "radio", "toolbar", "checkbox")

Presentation style

value = Property()

Value to set when the button is clicked

values_trait = Union(None, Str)

The name of the trait on the object that contains the list of possible values. If this is set, then the value, label, and label_value traits are ignored; instead, they will be set from this list. When this button is clicked, the value set will be the one selected from the drop-down.

view = AView

The optional view to display when the button is clicked:

traitsui.editors.button_editor.ToolkitEditorFactory

alias of ButtonEditor