From 9ab44d7e48940a0d24d3f94d638b49134bcf43f5 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 25 May 2019 11:43:11 -0400 Subject: [PATCH 1/2] More Comments --- DemoPrograms/Demo_Debugger_Integration.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/DemoPrograms/Demo_Debugger_Integration.py b/DemoPrograms/Demo_Debugger_Integration.py index 630313c4..48e2d538 100644 --- a/DemoPrograms/Demo_Debugger_Integration.py +++ b/DemoPrograms/Demo_Debugger_Integration.py @@ -1,18 +1,18 @@ import PySimpleGUI as sg -import PySimpleGUIdebugger +import PySimpleGUIdebugger # STEP 1 """ Demo program that shows you how to integrate the PySimpleGUI Debugger into your program. There are THREE steps, and they are copy and pastes. 1. At the top of your app to debug add import PySimpleGUIdebugger - 2. Initialize the debugger by calling: + 2. Initialize the debugger at the start of your program by calling: PySimpleGUIdebugger.initialize() - 2. At the top of your app's event loop add + 3. At the top of your app's Event Loop add: PySimpleGUIdebugger.refresh(locals(), globals()) """ -PySimpleGUIdebugger.initialize() +PySimpleGUIdebugger.initialize() # STEP 2 layout = [ [sg.T('A typical PSG application')], @@ -24,18 +24,17 @@ layout = [ [sg.Ok(), sg.Exit()], ] - window = sg.Window('This is your Application Window', layout) # Variables that we'll use to demonstrate the debugger's features counter = 0 timeout = 100 while True: # Event Loop - PySimpleGUIdebugger.refresh(locals(), globals()) # call the debugger to refresh the items being shown + PySimpleGUIdebugger.refresh(locals(), globals()) # STEP 3 - refresh debugger event, values = window.Read(timeout=timeout) if event in (None, 'Exit'): break elif event == 'Ok': print('You clicked Ok.... this is where print output goes') counter += 1 - window.Element('_OUT_').Update(values['_IN_']) + window.Element('_OUT_').Update(values['_IN_']) \ No newline at end of file From 2c01c065800f9982ff6dc9c6d3f5fdf2d404dc6b Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 25 May 2019 12:09:37 -0400 Subject: [PATCH 2/2] Added window close at end to cleanup --- DemoPrograms/Demo_Debugger_Integration.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/DemoPrograms/Demo_Debugger_Integration.py b/DemoPrograms/Demo_Debugger_Integration.py index 48e2d538..45c9462e 100644 --- a/DemoPrograms/Demo_Debugger_Integration.py +++ b/DemoPrograms/Demo_Debugger_Integration.py @@ -29,7 +29,7 @@ window = sg.Window('This is your Application Window', layout) counter = 0 timeout = 100 -while True: # Event Loop +while True: # Your Event Loop PySimpleGUIdebugger.refresh(locals(), globals()) # STEP 3 - refresh debugger event, values = window.Read(timeout=timeout) if event in (None, 'Exit'): @@ -37,4 +37,5 @@ while True: # Event Loop elif event == 'Ok': print('You clicked Ok.... this is where print output goes') counter += 1 - window.Element('_OUT_').Update(values['_IN_']) \ No newline at end of file + window.Element('_OUT_').Update(values['_IN_']) +window.Close()