Switch

class pyto_ui.Switch(on=False)

A control that offers a binary choice, such as On/Off. The function passed to action will be called when the switch changes its value.

property on: bool

A boolean indicating whether the switch is On.

Return type:

bool

property on_color: Color

The color used to tint the appearance of the switch when it is turned on.

Return type:

pyto_ui.Color

set_on_with_animation(on: bool)

Sets the state of the switch to On or Off with an animation.

Parameters:

on – A boolean indicating whether the switch should be On.

property thumb_color: Color

The color used to tint the appearance of the thumb.

Return type:

pyto_ui.Color