edifice.ButtonView#

class edifice.ButtonView(on_trigger=None, **kwargs)[source]#

Bases: HBoxView

Button with child layout.

A Button where the label is the Button’s children rendered in a edifice.HBoxView.

Props

All props from QtWidgetElement plus:

Parameters:

on_trigger (Union[Callable[[QKeyEvent], None], Callable[[QMouseEvent], None], None]) –

Event fires when the button is triggered by mouse or the Spacebar or Enter key. Event type is either QMouseEvent or QKeyEvent.

Use either this prop or on_click prop, not both.

Usage

Example ButtonView#
with ButtonView(
    on_trigger=lambda _event: print("Button Triggered"),
):
    Icon(name="share")
    Label(text="<i>Share the Content</i>")
../_images/button_view.png

Methods

__init__([on_trigger])

register_ref(reference)

Registers provided Reference to this Element.

set_key(key)

Set the key of an Element.

Attributes

children

The children of this Element.

props

The props of this Element.

underlying

The underlying QWidget, which may not exist if this Element has not rendered.