Update multiple or all widgets at once PySimpleGUI

Viewed 12

I have some code I'm building with PySimpleGUI. In this code I have some input boxes to add text and give an output. I keep writing the same line of code for 22 inputs (examples below), is there a way to do these all in one line rather than 22 separate lines?

window['-OUTPUT0-'].update(values['-INPUT0-'])
window['-OUTPUT1-'].update(values['-INPUT1-'])
if event == '-INPUT0-' and len(values['-INPUT0-']) and values['-INPUT0-'][-1] not in ('.-0123456789'):
        window['-INPUT0-'].update(values['-INPUT0-'][:-1])
if event == '-INPUT1-' and len(values['-INPUT1-']) and values['-INPUT1-'][-1] not in ('.-0123456789'):
        window['-INPUT1-'].update(values['-INPUT1-'][:-1])

Thanks

0 Answers
Related