Skip to content

PushButton

Push button with a caption, optionally illuminated (BOOL-006, BOOL-015).

PushButton, light theme PushButton, dark theme

Controls, discrete · Widget catalog · API reference · schema pushbutton.schema.json

Example

The traits of the picture above:

ai.PushButton(label="Push", text="START")

Traits

Trait Type Default Set by Description
color "grey", "green", "red", "black", "yellow", "blue", "white" "grey" host Cap color (IEC 60073: green to start, red to stop...).
lamp boolean or null null host Built-in lamp: true lit, false unlit, null no lamp (BOOL-015). Feedback set by the host, independent of value.
lamp_blink boolean false host Flash the lamp.
lamp_color "green", "red", "amber", "blue", "white" "green" host Lamp color.
mechanical_action "switch_when_pressed", "switch_when_released", "switch_until_released", "latch_when_pressed", "latch_when_released", "latch_until_released" "latch_when_released" host How the control reacts to the pointer (BOOL-007). With a latch, the host reads the value and restores default_state; without a host that does it, a latched value stays set.
shape "rect", "round" "rect" host rect (panel button) or round (operator); the Python class uses a 90 x 90 size for round.
size array [110,44] host [width, height] in CSS pixels.
text string "OK" host Caption (plain text, SEC-002).
Common traits (12), shared with other widgets
Trait Type Default Set by Description
mode "control", "indicator" "control" host "control": the user sets the value; "indicator": display only.
label string "" host Plain text, never interpreted as HTML (SEC-002).
disabled boolean false host Greyed out, input rejected.
visible boolean true host
tooltip string "" host Plain text shown on hover.
style "modern", "classic", "system" "modern" host
theme "auto", "light", "dark", "system" "auto" host "auto": the style decides; "system": the host page or the operating system (STYLE-007).
skin object {} host Replaceable drawing parts: part name -> SVG source, sanitized (STYLE-005, STYLE-006).
value boolean false host, widget State of the control or indicator. Set by the host, or by the user in control mode.
default_state boolean false host State a latch returns to once the host has read it (BOOL-008).
latch_timeout number 0 host Seconds after which an unread latch expires (host side); 0: never.
confirm boolean false host Ask for a confirmation before changing the value (BOOL-011).

Set by: host, the program (Python, Julia, ...); widget, the user through the widget; derived, computed from other traits by the host that owns the state, or by the widget. See the trait contract.