pdwidgets.widgets.switch

On/off switch widget.

class pdwidgets.widgets.switch.Switch(parent, x=0, y=0, w=None, h=None, align=None, align_to=None, fg=None, bg=None, visible=True, value=False, padding=None, on_color=None, off_color=None, knob_color=None)[source]

Bases: Widget

Pill track with sliding knob for boolean on/off.

toggle(data=None, event=None)[source]

Flip the switch between on and off.

draw(_=None)[source]

Draw the pill track and the knob at the on/off position.