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

digraph inheritance2d83301132 { rankdir=LR; width=8.0; ratio=compress; fontsize=14; size="8.0, 12.0"; "QtWidget" [style="setlinewidth(0.5)",URL="enaml.widgets.widget.Widget.html#enaml.qt.qt_widget.QtWidget",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25,shape=box,fontsize=10]; "QtObject" -> "QtWidget" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QtAbstractButton" [style="setlinewidth(0.5)",URL="#enaml.qt.qt_abstract_button.QtAbstractButton",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25,shape=box,fontsize=10]; "QtControl" -> "QtAbstractButton" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QtConstraintsWidget" [style="setlinewidth(0.5)",URL="enaml.widgets.constraints_widget.ConstraintsWidget.html#enaml.qt.qt_constraints_widget.QtConstraintsWidget",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25,shape=box,fontsize=10]; "QtWidget" -> "QtConstraintsWidget" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QtObject" [shape=box,style="setlinewidth(0.5)",fontsize=10,fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25]; "QtControl" [style="setlinewidth(0.5)",URL="enaml.widgets.control.Control.html#enaml.qt.qt_control.QtControl",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25,shape=box,fontsize=10]; "QtConstraintsWidget" -> "QtControl" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

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

digraph inheritance08260a37d0 { rankdir=LR; width=8.0; ratio=compress; fontsize=14; size="8.0, 12.0"; "WxObject" [shape=box,style="setlinewidth(0.5)",fontsize=10,fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25]; "WxAbstractButton" [style="setlinewidth(0.5)",URL="#enaml.wx.wx_abstract_button.WxAbstractButton",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25,shape=box,fontsize=10]; "WxControl" -> "WxAbstractButton" [arrowsize=0.5,style="setlinewidth(0.5)"]; "WxWidget" [style="setlinewidth(0.5)",URL="enaml.widgets.widget.Widget.html#enaml.wx.wx_widget.WxWidget",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25,shape=box,fontsize=10]; "WxObject" -> "WxWidget" [arrowsize=0.5,style="setlinewidth(0.5)"]; "WxConstraintsWidget" [style="setlinewidth(0.5)",URL="enaml.widgets.constraints_widget.ConstraintsWidget.html#enaml.wx.wx_constraints_widget.WxConstraintsWidget",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25,shape=box,fontsize=10]; "WxWidget" -> "WxConstraintsWidget" [arrowsize=0.5,style="setlinewidth(0.5)"]; "WxControl" [style="setlinewidth(0.5)",URL="enaml.widgets.control.Control.html#enaml.wx.wx_control.WxControl",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25,shape=box,fontsize=10]; "WxConstraintsWidget" -> "WxControl" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

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