Major demo refresh.. switched everything to new function names, new design patterns

Out with the old, in with the new!!
This commit is contained in:
MikeTheWatchGuy 2018-09-24 18:01:00 -04:00
parent 2a06683383
commit a1f4c60271
68 changed files with 706 additions and 1863 deletions

View file

@ -5,8 +5,8 @@ import PySimpleGUI as sg
STEP_SIZE=1
SAMPLES = 6000
CANVAS_SIZE = (6000,500)
SAMPLES = 1000
CANVAS_SIZE = (1000,500)
# globale used to communicate with thread.. yea yea... it's working fine
g_exit = False
@ -29,11 +29,11 @@ def main():
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')],]
form = sg.FlexForm('Canvas test', grab_anywhere=True, background_color='black', no_titlebar=False, use_default_focus=False)
form.Layout(layout)
window = sg.Window('Canvas test', grab_anywhere=True, background_color='black', no_titlebar=False, use_default_focus=False)
window.Layout(layout)
form.Finalize()
graph = form.FindElement('graph')
window.Finalize()
graph = window.FindElement('graph')
prev_response_time = None
i=0
@ -41,7 +41,7 @@ def main():
while True:
time.sleep(.2)
button, values = form.ReadNonBlocking()
button, values = window.ReadNonBlocking()
if button == 'Quit' or values is None:
break
if g_response_time is None or prev_response_time == g_response_time:
@ -52,7 +52,7 @@ def main():
graph.Move(-STEP_SIZE,0)
prev_x = prev_x - STEP_SIZE
graph.DrawLine((prev_x, prev_y), (new_x, new_y), color='white')
# form.FindElement('graph').DrawPoint((new_x, new_y), color='red')
# window.FindElement('graph').DrawPoint((new_x, new_y), color='red')
prev_x, prev_y = new_x, new_y
i += STEP_SIZE if i < SAMPLES else 0
@ -63,4 +63,3 @@ def main():
if __name__ == '__main__':
main()
exit(69)