New imports... switched order so that PyCharm will pick up with Python 3 import first

This commit is contained in:
MikeTheWatchGuy 2018-09-28 14:57:37 -04:00
parent aeafdfeb19
commit 4548b1dd9b
84 changed files with 1071 additions and 265 deletions

View file

@ -1,10 +1,9 @@
#!/usr/bin/env python
import sys
if sys.version_info[0] < 3:
import PySimpleGUI27 as sg
else:
if sys.version_info[0] >= 3:
import PySimpleGUI as sg
else:
import PySimpleGUI27 as sg
"""
Demonstration of MENUS!
How do menus work? Like buttons is how.
@ -27,13 +26,13 @@ def TestMenus():
sg.SetOptions(element_padding=(0, 0))
# ------ Menu Definition ------ #
menu_def = [['File', ['Open', 'Save', 'Properties']],
menu_def = [['File', ['O_&pen', 'Save', '---', 'Properties']],
['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],],
['Help', 'About...'],]
# ------ GUI Defintion ------ #
layout = [
[sg.Menu(menu_def, tearoff=True)],
[sg.Menu(menu_def, tearoff=False)],
[sg.Output(size=(60,20))],
[sg.In('Test', key='input', do_not_clear=True)]
]
@ -49,7 +48,9 @@ def TestMenus():
print('Button = ', button)
# ------ Process menu choices ------ #
if button == 'About...':
window.Disable()
sg.Popup('About this program','Version 1.0', 'PySimpleGUI rocks...')
window.Enable()
elif button == 'Open':
filename = sg.PopupGetFile('file to open', no_window=True)
print(filename)