4

I'm using PySimpleGUI in which I want to update a radio button. According to the documentation the radio button has an update method. But somehow it doesn't work properly.

I wrote the following code which should update the value of the radio button from Test to NewTest. The result is still Test.

Code used below:

import PySimpleGUI as sg

layout1 = [[sg.Radio('Test', "RADIO1", key='_RADIO1_', default=True, font=50)],
    [sg.Button('Ok', font=50), sg.Button('Stop', font=50)]]

window = sg.Window('Read').Layout(layout1).Finalize()

while True:
   window.Element('_RADIO1_').Update('NewTest')
   button, values = window.Read()
   exit()
4

1 に答える 1