Aug-09-2018, 03:42 PM
A change to how dictionaries work.
You no longer need to specify when creating the form that it should return a dictionary. If ANY element in the form that has a key specified will cause all of the elements to return a dictionary entry.
If one element has a key and others do not, then the other fields are simply numbered starting at 0. That number is used as the key for the field.
For example:
You no longer need to specify when creating the form that it should return a dictionary. If ANY element in the form that has a key specified will cause all of the elements to return a dictionary entry.
If one element has a key and others do not, then the other fields are simply numbered starting at 0. That number is used as the key for the field.
For example:
import PySimpleGUI as sg layout = [ [sg.Text('Please enter your Name, Address, Phone')], [sg.Text('Name', size=(15, 1)), sg.InputText('1')], [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], [sg.Submit(), sg.Cancel()] ] button, values = form.LayoutAndRead(layout) sg.MsgBox(button, values, values[0], values['address'], values['phone'])Two of the Input fields have keys but the first one doesn't. That means that the first field will be returned with a dictionary key of 0.