PySimpleGUI / PySimpleGUI/PySimpleGUI
[QUESTION] - how to reset radio buttons to False?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13.8k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
Question
windows 10
3.7
3.28
import PySimpleGUI as sg
layout = [[sg.Radio('No.1', "RADIO1", key='r1'),
sg.Radio('No.2', "RADIO1", key='r2'),
sg.Radio('No.3', "RADIO1", key='r3')],
[sg.Button('Reset'), sg.Button('List'), sg.Button('Exit')]]
window = sg.Window('Reset Buttons', font=("Helvetica", 12)).Layout(layout)
while True:
event, values = window.Read()
if event is None or event == 'Exit':
break
if event == 'List':
sg.Popup(values)
if event == 'Reset':
window.FindElement('r1').Update(False)
window.FindElement('r2').Update(False)
window.FindElement('r3').Update(False)
I'm sure this is a simple thing but if I'm new to programming and I'm struggling to get some radio buttons to reset back to False. the above code is what I have been using as a test.
After ticking a radio button and pressing the reset button intead of the selected button being deselected (becoming false) what happens is radio button r3 becomes true.
Where am I going wrong?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the radio-button example in the issue body and reproduce it using Python 3.7, PySimpleGUI 3.28, and Windows 10. Inspect the Reset handler and the Radio element's update behavior; the work is done when pressing Reset leaves r1, r2, and r3 all set to False.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100