From 11ad67b6b2f17f1faada5e6532f1d83df4ea2e25 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 17 May 2019 08:42:11 -0400 Subject: [PATCH] Added check toi automatically close hidden window when last window is closed --- PySimpleGUI.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 18879b19..4fcf7870 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -4097,6 +4097,13 @@ class Window: # _my_windows.Decrement() except: pass + # if down to 1 window, try and destroy the hidden window, if there is one + if Window.NumOpenWindows == 1: + try: + Window.hidden_master_root.destroy() + Window.NumOpenWindows = 0 # if no hidden window, then this won't execute + except: + pass CloseNonBlockingForm = Close CloseNonBlocking = Close @@ -4503,16 +4510,6 @@ def EncodeRadioRowCol(container, row, col): RadValue = container*100000 + row * 1000 + col return RadValue - -# --------------------------------------------------------------# -# Closes the hidden master window so PySimpleGUI can be closed # -# --------------------------------------------------------------# - -def ClosePySimpleGUI(): - Window.hidden_master_root.destroy() - Window.DecrementOpenCount() - - # ------- FUNCTION BuildResults. Form exiting so build the results to pass back ------- # # format of return values is # (Button Pressed, input_values)