Major update of all demo programs to use new PEP8 bindings, etc
This commit is contained in:
parent
3f7c87c562
commit
7f52778bcc
307 changed files with 19546 additions and 3297 deletions
|
@ -1,10 +1,5 @@
|
|||
#!/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
|
||||
|
||||
'''
|
||||
Quickly add a GUI to your script!
|
||||
|
@ -19,12 +14,16 @@ stores the result in the variable fname, just like the command line parsing did.
|
|||
'''
|
||||
|
||||
if len(sys.argv) == 1:
|
||||
event, (fname,) = sg.Window('My Script').Layout([[sg.T('Document to open')],
|
||||
[sg.In(), sg.FileBrowse()],
|
||||
[sg.CloseButton('Open'), sg.CloseButton('Cancel')]]).Read()
|
||||
layout = [
|
||||
[sg.Text('Document to open')],
|
||||
[sg.Input(), sg.FileBrowse()],
|
||||
[sg.CloseButton('Open'), sg.CloseButton('Cancel')]
|
||||
]
|
||||
window = sg.Window('My Script', layout)
|
||||
event, values = window.read()
|
||||
window.close()
|
||||
else:
|
||||
fname = sys.argv[1]
|
||||
|
||||
if not fname:
|
||||
sg.Popup("Cancel", "No filename supplied")
|
||||
sg.popup("Cancel", "No filename supplied")
|
||||
raise SystemExit("Cancelling: no filename supplied")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue