Added import code for BOTH 2.,7 and 3

This commit is contained in:
MikeTheWatchGuy 2018-09-27 16:24:09 -04:00
parent 8b4185988f
commit ab98ea20eb
66 changed files with 1284 additions and 136 deletions

View file

@ -1,4 +1,14 @@
# DESIGN PATTERN 1 - Simple Window
"""
When creating a new PySimpleGUI program from scratch, start here.
These are the accepted design patterns that cover the two primary use cases
1. A window that closes when a "submit" type button is clicked
2. A persistent window that stays open after button clicks (uses an event loop)
3. A persistent window that needs access to the elements' interface variables
"""
# ---------------------------------#
# DESIGN PATTERN 1 - Simple Window #
# ---------------------------------#
import PySimpleGUI as sg
layout = [[ sg.Text('My layout') ]]
@ -6,7 +16,10 @@ layout = [[ sg.Text('My layout') ]]
window = sg.Window('My window').Layout(layout)
button, value = window.Read()
# DESIGN PATTERN 2 - Persistent Window
# -------------------------------------#
# DESIGN PATTERN 2 - Persistent Window #
# -------------------------------------#
import PySimpleGUI as sg
layout = [[ sg.Text('My layout') ]]
@ -18,7 +31,9 @@ while True: # Event Loop
if button is None:
break
# DESIGN PATTERN 3 - Persistent Window with "early update" required
# ------------------------------------------------------------------#
# DESIGN PATTERN 3 - Persistent Window with "early update" required #
# ------------------------------------------------------------------#
import PySimpleGUI as sg
layout = [[ sg.Text('My layout') ]]