Web Analytics Made Easy - Statcounter
Skip to content

Return Values

There are 2 return values from a call to Window.read(), an event that caused the Read to return and values a list or dictionary of values. If there are no elements with keys in the layout, then it will be a list. However, some elements, like some buttons, have a key automatically added to them. It's best to use keys on all of your input type elements.

Two Return Values

All Window Read calls return 2 values. By convention a read statement is written:

event, values = window.read()

You don't HAVE to write your reads in this way. You can name your variables however you want. But if you want to code them in a way that other programmers using PySimpleGUI are used to, then use this statement.