Radio
Creates one radio button. Use multiple Radio
elements together by assigning them the same group_id
.
layout = [[sg.Radio('My first Radio!', group_id=1, default=True), sg.Radio('My second Radio!', group_id=1), sg.Radio('Disabled Radio!', group_id=1, disabled=True)]]
Events
If events are enabled for the Radio
element, then the element's key will be returned as an event when that radio button is clicked.
Values Dictionary
The values dictionary entry for a Radio
element is a boolean True
or False
. The value will be True
if it is currently selected.
Initial Setting
A Radio
element will be False
by default. If none of the other Radio
elements have a default
value of True
then all of your Radio
buttons in that group will have a value of False
until the user selects one. After an initial selection, there will always be one of the Radio
elements in the group with a value of True
.
Resetting a Group
If you wish to set all of the Radio
button elements in the group to False
, like when the window was first created, then you can call the method reset_group
which will set all Radio
elements in the group to False