Skip to content

radio_button

pdwidgets.widgets.radio_button

Radio button widget.

RadioButton(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, group=None)

Bases: Toggle

Mutually exclusive checked icon; belongs to a :class:RadioGroup.

Initialize a RadioButton widget.

Parameters:

Name Type Description Default
parent Widget

The parent widget or screen that contains this radio button.

required
x int

The x-coordinate of the radio button.

0
y int

The y-coordinate of the radio button.

0
w int

The width of the radio button.

None
h int

The height of the radio button.

None
align int

The alignment of the radio button.

None
align_to Widget

The widget to align to.

None
fg int

The color of the radio button.

None
bg int

The background color of the radio button.

None
visible bool

The visibility of the radio button.

True
value bool

The initial state of the radio button.

False
padding tuple

The padding on each side of the radio button.

None
size int

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

LARGE
group RadioGroup

The RadioGroup to which this radio button belongs.

None
Usage

radio_group = RadioGroup() radio_button = RadioButton(screen, group=radio_group)

toggle(data=None, event=None)

Toggle the checked state to true when clicked and uncheck other RadioButtons in the group.