2018-08-06 03:17:42 +00:00
|
|
|
import PySimpleGUI as sg
|
|
|
|
|
2018-09-04 23:43:22 +00:00
|
|
|
# Very basic form. Return values as a dictionary
|
2018-08-06 03:17:42 +00:00
|
|
|
form = sg.FlexForm('Simple data entry form') # begin with a blank form
|
|
|
|
|
2018-08-09 17:18:04 +00:00
|
|
|
layout = [
|
|
|
|
[sg.Text('Please enter your Name, Address, Phone')],
|
2018-09-04 23:43:22 +00:00
|
|
|
[sg.Text('Name', size=(15, 1)), sg.InputText('name', key='name')],
|
|
|
|
[sg.Text('Address', size=(15, 1)), sg.InputText('address', key='address')],
|
|
|
|
[sg.Text('Phone', size=(15, 1)), sg.InputText('phone', key='phone')],
|
|
|
|
[sg.Ok(), sg.Cancel()]
|
2018-08-09 17:18:04 +00:00
|
|
|
]
|
2018-08-06 03:17:42 +00:00
|
|
|
|
2018-08-09 17:18:04 +00:00
|
|
|
button, values = form.LayoutAndRead(layout)
|
2018-08-06 03:17:42 +00:00
|
|
|
|
2018-09-06 16:01:19 +00:00
|
|
|
print(button, values, values['name'], values['address'], values['phone'])
|
2018-08-09 17:18:04 +00:00
|
|
|
|
2018-09-04 23:43:22 +00:00
|
|
|
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('name')],
|
|
|
|
[sg.Text('Address', size=(15, 1)), sg.InputText('address')],
|
|
|
|
[sg.Text('Phone', size=(15, 1)), sg.InputText('phone')],
|
|
|
|
[sg.Ok(), sg.Cancel()]
|
|
|
|
]
|
|
|
|
|
|
|
|
button, values = form.LayoutAndRead(layout)
|
2018-09-06 16:01:19 +00:00
|
|
|
print(values)
|
2018-09-04 23:43:22 +00:00
|
|
|
name, address, phone = values
|
|
|
|
sg.MsgBox(button, values[0], values[1], values[2])
|