Toggle
A sliding on / off switch.
with sc.Toggle('Auto refresh', value=True) as toggle:
@toggle.value.on_change
def _():
auto_refresh.set(toggle.value.get())
| Argument | Type | Meaning |
|---|---|---|
label | str | Property | Label |
value | bool | Property | On / off state, default False |
label_visibility | str | See Inputs |
Properties: label, value.
Signals: value.on_change (toggle['on_value']).
Toggle is an alias of ToggleBox. Its fields match Checkbox; only the
visual differs.
Toggle versus ToggleButton
ToggleBox(Toggle) is an input widget: it belongs among other form controls and has a label above it.ToggleButtonis a button that stays lit. It belongs in a toolbar, and itstypeis derived from its state.