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,14 +1,10 @@
#!/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
'''
Use this code as a starting point for creating your own Popup functions.
Rather than creating a long list of Popup high-level API calls, PySimpleGUI provides
you with the tools to easily create your own. If you need more than what the standard PopupGetText and
you with the tools to easily create your own. If you need more than what the standard popup_get_text and
other calls provide, then it's time for you to graduate into making your own windows. Or, maybe you need
another window that pops-up over your primary window. Whatever the need, don't hesitate to dive in
and create your own Popup call.
@ -19,15 +15,15 @@ else:
def PopupDropDown(title, text, values):
window = sg.Window(title).Layout([[sg.Text(text)],
[sg.DropDown(values, key='_DROP_')],
[sg.OK(), sg.Cancel()]])
event, values = window.Read()
return None if event != 'OK' else values['_DROP_']
window = sg.Window(title,
[[sg.Text(text)],
[sg.DropDown(values, key='-DROP-')],
[sg.OK(), sg.Cancel()]
])
event, values = window.read()
return None if event != 'OK' else values['-DROP-']
# ----------------------- Calling your PopupDropDown function -----------------------
values = ['choice {}'.format(x) for x in range(30)]
print(PopupDropDown('My Title', 'Please make a selection', values))