PySimpleGUI/DemoPrograms/Demo_Super_Simple_Form.py

21 lines
762 B
Python
Raw Normal View History

import PySimpleGUI as sg
2018-08-06 03:17:42 +00:00
2020-05-16 16:54:45 +00:00
"""
Simple Form (a one-shot data entry window)
Use this design pattern to show a form one time to a user that is "submitted"
"""
layout = [[sg.Text('Please enter your Name, Address, Phone')],
[sg.Text('Name', size=(10, 1)), sg.InputText(key='-NAME-')],
[sg.Text('Address', size=(10, 1)), sg.InputText(key='-ADDRESS-')],
[sg.Text('Phone', size=(10, 1)), sg.InputText(key='-PHONE-')],
[sg.Button('Submit'), sg.Button('Cancel')]]
window = sg.Window('Simple Data Entry Window', layout)
event, values = window.read(close=True)
2020-05-16 16:54:45 +00:00
if event == 'Submit':
print('The events was ', event, 'You input', values['-NAME-'], values['-ADDRESS-'], values['-PHONE-'])
else:
print('User cancelled')