Removed need to flag a form as one returning a dictionary

This commit is contained in:
MikeTheWatchGuy 2018-08-09 11:37:44 -04:00
parent 49e89c7875
commit 9c1ebeb0b4
2 changed files with 46 additions and 21 deletions

View file

@ -2,14 +2,19 @@ import PySimpleGUI as sg
# THIS FILE REQIRES THE LATEST PySimpleGUI.py FILE
# IT WILL NOT WORK WITH CURRENT PIP RELEASE (2.7)
#
# If you want to use the return values as Dictionary feature, you need to download the PySimpleGUI.py file
# from GitHub and then place it in your project's folder. This SHOULD cause it to use this downloaded version
# instead of the pip installed one, if you've pip installed it. You can always uninstall the pip one :-)
# Shows how to use return values in dictionary form
form = sg.FlexForm('Simple data entry form', use_dictionary=True) # begin with a blank form
# This design pattern shows how to use return values in dictionary form
form = sg.FlexForm('Simple data entry form') # begin with a blank form
layout = [
[sg.Text('Please enter your Name, Address, Phone')],
[sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')],
[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()]
@ -17,6 +22,6 @@ layout = [
button, values = form.LayoutAndRead(layout)
sg.MsgBox(button, values, values['name'], values['address'], values['phone'])
sg.MsgBox(button, values, values[0], values['address'], values['phone'])
print(values)