diff options
author | emkael <emkael@tlen.pl> | 2019-07-19 12:05:18 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2019-07-19 12:05:18 +0200 |
commit | 914c73d5aa2d87d55bcc10b3bf5cfd4d4f6a8f93 (patch) | |
tree | 55ce93985427ab85e77f399362ad38c8a1f51e4a /jfr_playoff/gui/frames/__init__.py | |
parent | 1059281a8962dd7529318b529aeda02ca8544722 (diff) |
"Handling" of some GUI errors that occur during file load/unload and component attach/detach
Diffstat (limited to 'jfr_playoff/gui/frames/__init__.py')
-rw-r--r-- | jfr_playoff/gui/frames/__init__.py | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/jfr_playoff/gui/frames/__init__.py b/jfr_playoff/gui/frames/__init__.py index bef832f..855be4e 100644 --- a/jfr_playoff/gui/frames/__init__.py +++ b/jfr_playoff/gui/frames/__init__.py @@ -382,19 +382,24 @@ class RefreshableOptionMenu(ttk.OptionMenu): self.__callback(self._valueVariable, *args) def refreshOptions(self, *args): - options = self.getOptions() - self['menu'].delete(0, tk.END) - for label, option in options: - self['menu'].add_command( - label=label, - command=self._setit( - self._variable, self._valueVariable, - label, option, self._callback)) - self._valueLock = True - self._valueVariable.set( - self._lastValue - if self._lastValue in [option[1] for option in options] else '') - self._valueLock = False + try: + options = self.getOptions() + self['menu'].delete(0, tk.END) + for label, option in options: + self['menu'].add_command( + label=label, + command=self._setit( + self._variable, self._valueVariable, + label, option, self._callback)) + self._valueLock = True + self._valueVariable.set( + self._lastValue + if self._lastValue in [option[1] for option in options] + else '') + self._valueLock = False + except tk.TclError: + # we're probably being destroyed, ignore + pass def getOptions(self): return [ |