From 4228c1eb353156a5b92529e7144549aa8d8e58c3 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 23 Sep 2018 12:40:31 -0400 Subject: [PATCH] Removed LookAndFeel capability for Mac platform. The function does nothing if sys.platform == 'darwin'. Added warning messages trying to help user when Finalize is not called when it should be. Removed candidate function names PrepareForUpdate and PreRead. Ended up using Finalize as final function name --- PySimpleGUI.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 4d9fab53..3f21b065 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1233,6 +1233,9 @@ class Canvas(Element): @property def TKCanvas(self): + if self._TKCanvas is None: + print('*** Did you forget to call Finalize()? Your code should look something like: ***') + print('*** form = sg.FlexForm("My Form").Layout(layout).Finalize() ***') return self._TKCanvas @@ -1308,6 +1311,9 @@ class Graph(Element): @property def TKCanvas(self): + if self._TKCanvas2 is None: + print('*** Did you forget to call Finalize()? Your code should look something like: ***') + print('*** form = sg.FlexForm("My Form").Layout(layout).Finalize() ***') return self._TKCanvas2 def __del__(self): @@ -2015,10 +2021,6 @@ class FlexForm: # return None, None return self - # Another name for ReadNonBlocking. - PrepareForUpdate = ReadNonBlocking - # Finalize = ReadNonBlocking - PreRead = ReadNonBlocking def Refresh(self): @@ -3976,6 +3978,10 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), button_el # of the elements. # ############################################################## def ChangeLookAndFeel(index): + if sys.platform == 'darwin': + print('*** Changing look and feel is not supported on Mac platform ***') + return + # look and feel table look_and_feel = {'SystemDefault': {'BACKGROUND' : COLOR_SYSTEM_DEFAULT, 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT': COLOR_SYSTEM_DEFAULT,'TEXT_INPUT' : COLOR_SYSTEM_DEFAULT, 'SCROLL': COLOR_SYSTEM_DEFAULT, 'BUTTON': OFFICIAL_PYSIMPLEGUI_BUTTON_COLOR, 'PROGRESS': COLOR_SYSTEM_DEFAULT, 'BORDER': 1,'SLIDER_DEPTH':1, 'PROGRESS_DEPTH':0},