Merge pull request #338 from MikeTheWatchGuy/Dev-latest
DEMO WITH SUGGESTED DESIGN PATTERNS
This commit is contained in:
commit
5197d89e47
|
@ -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
|
|
@ -29,10 +29,8 @@ def main():
|
||||||
layout = [ [sg.T('Ping times to Google.com', font='Any 12'), sg.Quit(pad=((100,0), 0), button_color=('white', 'black'))],
|
layout = [ [sg.T('Ping times to Google.com', font='Any 12'), sg.Quit(pad=((100,0), 0), button_color=('white', 'black'))],
|
||||||
[sg.Graph(CANVAS_SIZE, (0,0), (SAMPLES,500),background_color='black', key='graph')],]
|
[sg.Graph(CANVAS_SIZE, (0,0), (SAMPLES,500),background_color='black', key='graph')],]
|
||||||
|
|
||||||
window = sg.Window('Canvas test', grab_anywhere=True, background_color='black', no_titlebar=False, use_default_focus=False)
|
window = sg.Window('Canvas test', grab_anywhere=True, background_color='black', no_titlebar=False, use_default_focus=False).Layout(layout)
|
||||||
window.Layout(layout)
|
|
||||||
|
|
||||||
window.Finalize()
|
|
||||||
graph = window.FindElement('graph')
|
graph = window.FindElement('graph')
|
||||||
|
|
||||||
prev_response_time = None
|
prev_response_time = None
|
||||||
|
|
Loading…
Reference in New Issue