NEW form.SaveToDisk and form.LoadFromDisk!
Another user submitted feature request
This commit is contained in:
parent
75970ade87
commit
667000ea2a
2 changed files with 26 additions and 21 deletions
|
@ -7,6 +7,7 @@ import tkinter.font
|
|||
import datetime
|
||||
import sys
|
||||
import textwrap
|
||||
import pickle
|
||||
|
||||
|
||||
# ----====----====----==== Constants the user CAN safely change ====----====----====----#
|
||||
|
@ -1361,10 +1362,29 @@ class FlexForm:
|
|||
def Fill(self, values_dict):
|
||||
FillFormWithValues(self, values_dict)
|
||||
|
||||
|
||||
def FindElement(self, key):
|
||||
return _FindElementFromKeyInSubForm(self, key)
|
||||
|
||||
|
||||
def SaveToDisk(self, filename):
|
||||
try:
|
||||
results = BuildResults(self, False, self)
|
||||
with open(filename, 'wb') as sf:
|
||||
pickle.dump(results[1], sf)
|
||||
except:
|
||||
print('*** Error saving form to disk ***')
|
||||
|
||||
|
||||
def LoadFromDisk(self, filename):
|
||||
try:
|
||||
with open(filename, 'rb') as df:
|
||||
self.Fill(pickle.load(df))
|
||||
except:
|
||||
print('*** Error loading form to disk ***')
|
||||
|
||||
|
||||
|
||||
def GetScreenDimensions(self):
|
||||
if self.TKrootDestroyed:
|
||||
return None, None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue