Major update of all demo programs to use new PEP8 bindings, etc

This commit is contained in:
PySimpleGUI 2019-10-23 16:10:03 -04:00
parent 3f7c87c562
commit 7f52778bcc
307 changed files with 19546 additions and 3297 deletions

View file

@ -1,48 +1,46 @@
#!/usr/bin/env python
import sys
if sys.version_info[0] >= 3:
import PySimpleGUI as sg
else:
import PySimpleGUI27 as sg
import PySimpleGUI as sg
"""
Demonstrates the new change_submits parameter for inputtext elements
It ONLY submits when a button changes the field, not normal user input
Be careful on persistent forms to not clear the input
"""
layout = [[ sg.Text('Test of reading input field') ],
[sg.T('This input is normal'), sg.In()],
[sg.T('This input change submits'), sg.In(change_submits=True)],
[sg.T('This multiline input change submits'), sg.Multiline(change_submits=True, do_not_clear=True)],
[sg.T('This input is normal'), sg.In(), sg.FileBrowse()],
[sg.T('File Browse submits'), sg.In(change_submits=True,
do_not_clear=True,
key='_in1_'), sg.FileBrowse()],
[sg.T('Color Chooser submits'), sg.In(change_submits=True,
do_not_clear=True,
key='_in2_'), sg.ColorChooserButton('Color...', target=(sg.ThisRow, -1))],
[sg.T('Folder Browse submits'), sg.In(change_submits=True,
do_not_clear=True,
key='_in3_'), sg.FolderBrowse()],
[sg.T('Calendar Chooser submits'), sg.In(change_submits=True,
do_not_clear=True,
key='_in4_'), sg.CalendarButton('Date...', target=(sg.ThisRow, -1))],
[sg.T('Disabled input submits'), sg.In(change_submits=True,
do_not_clear=True,
disabled=True,
key='_in5'), sg.FileBrowse()],
[sg.T('This input clears after submit'),sg.In(change_submits=True,
key='_in6_'), sg.FileBrowse()],
[ sg.Button('Read')]]
layout = [[sg.Text('Test of reading input field')],
[sg.Text('This input is normal'), sg.Input()],
[sg.Text('This input change submits'),
sg.Input(change_submits=True)],
[sg.Text('This multiline input change submits'),
sg.ML('', change_submits=True)],
[sg.Text('This input is normal'),
sg.Input(), sg.FileBrowse()],
[sg.Text('File Browse submits'),
sg.Input(change_submits=True,
key='-in1-'), sg.FileBrowse()],
[sg.Text('Color Chooser submits'),
sg.Input(change_submits=True,
key='-in2-'), sg.ColorChooserButton('Color...', target=(sg.ThisRow, -1))],
[sg.Text('Folder Browse submits'),
sg.Input(change_submits=True,
key='-in3-'), sg.FolderBrowse()],
[sg.Text('Calendar Chooser submits'),
sg.Input(change_submits=True,
key='-in4-'), sg.CalendarButton('Date...', target=(sg.ThisRow, -1))],
[sg.Text('Disabled input submits'),
sg.Input(change_submits=True,
disabled=True,
key='_in5'), sg.FileBrowse()],
[sg.Text('This input clears after submit'),
sg.Input(change_submits=True, key='-in6-'), sg.FileBrowse()],
[sg.Button('Read')]]
window = sg.Window('Demonstration of InputText with change_submits',
auto_size_text=False,
default_element_size=(22,1),
text_justification='right',
).Layout(layout)
layout, auto_size_text=False, default_element_size=(22, 1),
text_justification='right')
while True: # Event Loop
event, values = window.Read()
event, values = window.read()
print(event, values)
if event is None:
break
window.close()