Button classes

Simple example:

b = ui.Button(text="Push me")
open in new tab

Also see examples: buttons.py.


class flexx.ui.BaseButton(*init_args, **kwargs)

Inherits from: Widget

Abstract button class.

properties: checked, disabled, text

emitters: user_checked

actions: set_checked, set_disabled, set_text

checked

BoolProp – Whether the button is checked.

disabled

BoolProp – Whether the button is disabled.

set_checked(*val)

action – Setter for the ‘checked’ property.

set_disabled(*val)

action – Setter for the ‘disabled’ property.

set_text(*val)

action – Setter for the ‘text’ property.

text

StringProp – The text on the button.

user_checked(checked)

emitter – Event emitted when the user (un)checks this button. Has old_value and new_value attributes.

class flexx.ui.Button(*init_args, **kwargs)

Inherits from: BaseButton

A push button.

The node of this widget is a <button>.

JS

alias of Button

class flexx.ui.CheckBox(*init_args, **kwargs)

Inherits from: BaseButton

A checkbox button.

The outernode of this widget is a <label>, and the node a checkbox <input>.

JS

alias of CheckBox

class flexx.ui.RadioButton(*init_args, **kwargs)

Inherits from: BaseButton

A radio button. Of any group of radio buttons that share the same parent, only one can be active.

The outernode of this widget is a <label>, and the node a radio <input>.

emitters: pointer_click

pointer_click(e)

emitter – This method is called on JS a click event. We first update the checked properties, and then emit the Flexx click event. That way, one can connect to the click event and have an up-to-date checked props (even on Py).

class flexx.ui.ToggleButton(*init_args, **kwargs)

Inherits from: BaseButton

A button that can be toggled. It behaves like a checkbox, while looking more like a regular button.

The node of this widget is a <button>.

JS

alias of ToggleButton