Merge pull request #1752 from PySimpleGUI/Dev-latest

Remove buttons from list of values to save to disk
This commit is contained in:
MikeTheWatchGuy 2019-07-29 16:34:40 -04:00 committed by GitHub
commit 5931a5805d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -5532,11 +5532,17 @@ class Window:
:param filename: (str) Filename to save the values to in pickled form :param filename: (str) Filename to save the values to in pickled form
""" """
try: 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: with open(filename, 'wb') as sf:
pickle.dump(results[1], sf) pickle.dump(values, sf)
except: except:
print('*** Error saving form to disk ***') print('*** Error saving Window contents to disk ***')
def LoadFromDisk(self, filename): def LoadFromDisk(self, filename):
""" """