Skip to content

toggle_button

pdwidgets.widgets.toggle_button

Standard on/off toggle button.

ToggleButton(parent, x=0, y=0, w=None, h=None, align=None, align_to=None, fg=None, bg=None, visible=True, value=False, padding=None, size=ICON_SIZE.LARGE)

Bases: Toggle

Pre-themed :class:Toggle using standard on/off icons.

Initialize a ToggleButton widget.

Parameters:

Name Type Description Default
parent Widget

The parent widget or screen that contains this toggle button.

required
x int

The x-coordinate of the toggle button.

0
y int

The y-coordinate of the toggle button.

0
w int

The width of the toggle button.

None
h int

The height of the toggle button.

None
align int

The alignment of the toggle button.

None
align_to Widget

The widget to align to.

None
fg int

The color of the toggle button.

None
bg int

The background color of the toggle button.

None
visible bool

The visibility of the toggle button.

True
value bool

The initial state of the toggle button.

False
padding tuple

The padding on each side of the toggle button.

None
size int

The size of the toggle button (default is ICON_SIZE.LARGE).

LARGE
Usage

toggle_button = ToggleButton(screen, size=ICON_SIZE.LARGE)