PySimpleGUI sg.Radio button error: __init__() missing 1 required positional argument: 'group_id'

750 views Asked by At

When I run my code for sg.Radio I get the following error, please could someone help?

TypeError: init() missing 1 required positional argument: 'group_id'

[sg.Radio('1',key= 'RADIO1', enable_events = True,size=(10,1)),
    sg.Radio('2', key= 'RADIO2',enable_events = True, default=False, size=(10,1)),
    sg.Radio('3', key='RADIO3',enable_events = True, default=False, size=(12,1)),
    sg.Radio('4', key='RADIO4', enable_events = True,default=False, size=(12,1))]]
1

There are 1 answers

2
Shweta On BEST ANSWER

You need to modify your syntax and give a group_id=<some_name> parameter.

The reason for this is that it is a radio button that allows you to select only one value from a particular group(as opposed to a check box where you can select multiple values).