Saves the values contained in each of the input areas of the form. Basically saves what would be returned from a call to Read. It takes these results and saves them to disk using pickle. Note that every element in your layout that is to be saved must have a key assigned to it.
(self, filename)
| 11178 | |
| 11179 | |
| 11180 | def save_to_disk(self, filename): |
| 11181 | """ |
| 11182 | Saves the values contained in each of the input areas of the form. Basically saves what would be returned from a call to Read. It takes these results and saves them to disk using pickle. |
| 11183 | Note that every element in your layout that is to be saved must have a key assigned to it. |
| 11184 | |
| 11185 | :param filename: Filename to save the values to in pickled form |
| 11186 | :type filename: str |
| 11187 | """ |
| 11188 | try: |
| 11189 | event, values = _BuildResults(self, False, self) |
| 11190 | remove_these = [] |
| 11191 | for key in values: |
| 11192 | if self.Element(key).Type == ELEM_TYPE_BUTTON: |
| 11193 | remove_these.append(key) |
| 11194 | for key in remove_these: |
| 11195 | del values[key] |
| 11196 | with open(filename, 'wb') as sf: |
| 11197 | pickle.dump(values, sf) |
| 11198 | except: |
| 11199 | print('*** Error saving Window contents to disk ***') |
| 11200 | |
| 11201 | def load_from_disk(self, filename): |
| 11202 | """ |
nothing calls this directly
no test coverage detected