|
60 | 60 | # destroyed before .__del__ methods here are called. The following |
61 | 61 | # is used to selectively ignore shutdown exceptions to avoid |
62 | 62 | # 'Exception ignored' messages. See http://bugs.python.org/issue20167 |
63 | | -APPLICATION_GONE = '''\ |
64 | | -can't invoke "bind" command: application has been destroyed''' |
| 63 | +APPLICATION_GONE = "application has been destroyed" |
65 | 64 |
|
66 | 65 | # A binder is a class which binds functions to one type of event. It has two |
67 | 66 | # methods: bind and unbind, which get a function and a parsed sequence, as |
@@ -108,9 +107,7 @@ def __del__(self): |
108 | 107 | self.widget.unbind(self.widgetinst, self.sequence, |
109 | 108 | self.handlerid) |
110 | 109 | except tkinter.TclError as e: |
111 | | - if e.args[0] == APPLICATION_GONE: |
112 | | - pass |
113 | | - else: |
| 110 | + if not APPLICATION_GONE in e.args[0]: |
114 | 111 | raise |
115 | 112 |
|
116 | 113 | # An int in range(1 << len(_modifiers)) represents a combination of modifiers |
@@ -243,9 +240,7 @@ def __del__(self): |
243 | 240 | try: |
244 | 241 | self.widget.unbind(self.widgetinst, seq, id) |
245 | 242 | except tkinter.TclError as e: |
246 | | - if e.args[0] == APPLICATION_GONE: |
247 | | - break |
248 | | - else: |
| 243 | + if not APPLICATION_GONE in e.args[0]: |
249 | 244 | raise |
250 | 245 |
|
251 | 246 | # define the list of event types to be handled by MultiEvent. the order is |
@@ -412,9 +407,7 @@ def __del__(self): |
412 | 407 | try: |
413 | 408 | self.__binders[triplet[1]].unbind(triplet, func) |
414 | 409 | except tkinter.TclError as e: |
415 | | - if e.args[0] == APPLICATION_GONE: |
416 | | - break |
417 | | - else: |
| 410 | + if not APPLICATION_GONE in e.args[0]: |
418 | 411 | raise |
419 | 412 |
|
420 | 413 | _multicall_dict[widget] = MultiCall |
|
0 commit comments