From 7a30a808a4a4db0740162127f9e35301b0e2663b Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 17 May 2019 08:25:22 -0400 Subject: [PATCH] New function - ClosePySimpleGUI() - deletes the hidden master window --- PySimpleGUI.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 0a293db5..18879b19 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -61,6 +61,14 @@ def TimerStop(): are not a mess. The Elements and the methods for them are well-designed. PEP8 - this code is far far from PEP8 compliant. It was written PRIOR to learning that PEP8 existed. + + I'll be honest.... started learning Python in Nov 2017, started writing PySimpleGUI in Feb 2018. + Released PySimpleGUI in July 2018. I knew so little about Python that my parameters were all named + using CamelCase. DOH! Someone on Reddit set me straight on that. So overnight I renamed all of the + parameters to lower case. Unfortunately, the internal naming conventions have been set. Mixing them + with PEP8 at this moment would be even MORE confusing. + + Code I write now, outside PySimpleGUI, IS PEP8 compliant. The variable and function naming in particular are not compliant. There is liberal use of CamelVariableAndFunctionNames. If you've got a serious enough problem with this @@ -3937,7 +3945,7 @@ class Window: 'window.FindElement("{}")'.format(key)) return ErrorElement(key=key) else: - return False + return None return element Element = FindElement # Shortcut function @@ -4496,6 +4504,15 @@ def EncodeRadioRowCol(container, row, 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)