DEMO WITH SUGGESTED DESIGN PATTERNS
This commit is contained in:
parent
a1f4c60271
commit
7b0a6be951
2 changed files with 32 additions and 3 deletions
31
Demo_Design_Patterns.py
Normal file
31
Demo_Design_Patterns.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
# DESIGN PATTERN 1 - Simple Window
|
||||
import PySimpleGUI as sg
|
||||
|
||||
layout = [[ sg.Text('My layout') ]]
|
||||
|
||||
window = sg.Window('My window').Layout(layout)
|
||||
button, value = window.Read()
|
||||
|
||||
# DESIGN PATTERN 2 - Persistent Window
|
||||
import PySimpleGUI as sg
|
||||
|
||||
layout = [[ sg.Text('My layout') ]]
|
||||
|
||||
window = sg.Window('My new window').Layout(layout)
|
||||
|
||||
while True: # Event Loop
|
||||
button, value = window.Read()
|
||||
if button is None:
|
||||
break
|
||||
|
||||
# DESIGN PATTERN 3 - Persistent Window with "early update" required
|
||||
import PySimpleGUI as sg
|
||||
|
||||
layout = [[ sg.Text('My layout') ]]
|
||||
|
||||
window = sg.Window('My new window').Layout(layout).Finalize()
|
||||
|
||||
while True: # Event Loop
|
||||
button, value = window.Read()
|
||||
if button is None:
|
||||
break
|
Loading…
Add table
Add a link
Reference in a new issue