Page Contents

This Page

AbstractButton

class enaml.widgets.abstract_button.AbstractButton(parent=None, **kwargs)[source]

Bases: enaml.widgets.control.Control

A base class which provides functionality common for several button-like widgets.

text = None

The text to use as the button’s label.

icon_source = None

The source url for the icon to use for the button.

icon_size = None

The size to use for the icon. The default is an invalid size and indicates that an appropriate default should be used.

checkable = None

Whether or not the button is checkable. The default is False.

checked = None

Whether a checkable button is currently checked.

clicked = None

Fired when the button is pressed then released. The payload will be the current checked state.

toggled = None

Fired when a checkable button is toggled. The payload will be the current checked state.

hug_width = None

How strongly a component hugs it’s contents’ width. Buttons hug their contents’ width weakly by default.

snapshot()[source]

Returns the snapshot for an abstract button.

bind()[source]

Bind the change handlers for an abstract button.

on_action_clicked(content)[source]

Handle the ‘clicked’ action from the UI widget.

The content will contain the current checked state.

on_action_toggled(content)[source]

Handle the ‘toggled’ action from the UI widget.

The payload will contain the current checked state.

__implements__

alias of __NoInterface__

Backends

Qt

Inheritance diagram of enaml.qt.qt_abstract_button.QtAbstractButton

class enaml.qt.qt_abstract_button.QtAbstractButton(object_id, parent, session)[source]

Bases: enaml.qt.qt_control.QtControl

A Qt implementation of the Enaml AbstractButton class.

This class can serve as a base class for widgets that implement button behavior such as CheckBox, RadioButton and PushButtons. It is not meant to be used directly.

create_widget(parent, tree)[source]

This method must be implemented by subclasses to create the proper button widget.

create(tree)[source]

Create and initialize the abstract button widget.

activate()[source]

Activate the button widget.

on_clicked()[source]

The signal handler for the ‘clicked’ signal.

on_toggled()[source]

The signal handler for the ‘toggled’ signal.

on_action_set_checked(content)[source]

Handle the ‘set_checked’ action from the Enaml widget.

on_action_set_text(content)[source]

Handle the ‘set_text’ action from the Enaml widget.

on_action_set_icon_source(content)[source]

Handle the ‘set_icon_source’ action from the Enaml widget.

on_action_set_icon_size(content)[source]

Handle the ‘set_icon_size’ action from the Enaml widget.

set_checkable(checkable)[source]

Sets whether or not the widget is checkable.

set_checked(checked)[source]

Sets the widget’s checked state with the provided value.

set_text(text)[source]

Sets the widget’s text with the provided value.

set_icon_source(icon_source)[source]

Sets the widget’s icon to the provided image.

set_icon_size(icon_size)[source]

Sets the widget’s icon size to the provided size.

Wx

Inheritance diagram of enaml.wx.wx_abstract_button.WxAbstractButton

class enaml.wx.wx_abstract_button.WxAbstractButton(object_id, parent, session)[source]

Bases: enaml.wx.wx_control.WxControl

A Wx implementation of the Enaml AbstractButton class.

This class can serve as a base class for widgets that implement button behavior such as CheckBox, RadioButton and PushButtons. It is not meant to be used directly.

create_widget(parent, tree)[source]

This method must be implemented by subclasses to create the proper button widget.

create(tree)[source]

Create and initialize the abstract button widget.

Subclasses should reimplement this method and bind appropriate event handlers to the ‘on_clicked’ and ‘on_toggled’ event handlers.

on_action_set_checked(content)[source]

Handle the ‘set_checked’ action from the Enaml widget.

on_action_set_text(content)[source]

Handle the ‘set_text’ action from the Enaml widget.

on_action_set_icon_size(content)[source]

Handle the ‘set_icon_size’ action from the Enaml widget.

on_clicked(event)[source]

The event handler for the clicked event.

Parameters:event (wxEvent) – The wx event object. This is ignored by the handler.
on_toggled(event)[source]

The event handler for the toggled event.

Parameters:event (wxEvent) – The wx event object. This is ignored by the handler.
set_checkable(checkable)[source]

Sets whether or not the widget is checkable.

get_checked()[source]

Returns the checked state of the widget.

set_checked(checked)[source]

Sets the widget’s checked state with the provided value.

set_text(text)[source]

Sets the widget’s text with the provided value.

set_icon(icon)[source]

Sets the widget’s icon to the provided image

set_icon_size(icon_size)[source]

Sets the widget’s icon size to the provided tuple