From 871f30d11fea6eb4112575a0cd4e25d755677498 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 29 Jul 2019 16:34:13 -0400 Subject: [PATCH] Remove buttons from list of values to save to disk --- PySimpleGUI.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 81733af6..58952d6f 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -5532,11 +5532,17 @@ class Window: :param filename: (str) Filename to save the values to in pickled form """ try: - results = _BuildResults(self, False, self) + event, values = _BuildResults(self, False, self) + remove_these = [] + for key in values: + if self.Element(key).Type == ELEM_TYPE_BUTTON: + remove_these.append(key) + for key in remove_these: + del values[key] with open(filename, 'wb') as sf: - pickle.dump(results[1], sf) + pickle.dump(values, sf) except: - print('*** Error saving form to disk ***') + print('*** Error saving Window contents to disk ***') def LoadFromDisk(self, filename): """