summaryrefslogtreecommitdiffstats
path: root/Lib/lib-tk
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-02-08 15:26:49 (GMT)
committerGuido van Rossum <guido@python.org>1999-02-08 15:26:49 (GMT)
commitc55b0ca60186d021fb08557ab487b123bc06fcc8 (patch)
tree8c4305b416982a2cabcd3a15281c5fd9f8258d2f /Lib/lib-tk
parent7f1653c0e5e082cbf284c907913990ed2c37f116 (diff)
downloadcpython-c55b0ca60186d021fb08557ab487b123bc06fcc8.zip
cpython-c55b0ca60186d021fb08557ab487b123bc06fcc8.tar.gz
cpython-c55b0ca60186d021fb08557ab487b123bc06fcc8.tar.bz2
Put a try-except around the "image delete" call in Image.__del__ to
avoid tracebacks when the root is destroyed before the image object.
Diffstat (limited to 'Lib/lib-tk')
-rw-r--r--Lib/lib-tk/Tkinter.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
index 344dd8a..3e98cd6 100644
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -4,7 +4,7 @@ __version__ = "$Revision$"
import sys
if sys.platform == "win32":
- import FixTk # Attempt to configure Tcl/Tk without requiring PATH
+ import FixTk # Attempt to configure Tcl/Tk without requiring PATH
import _tkinter # If this fails your Python may not be configured for Tk
tkinter = _tkinter # b/w compat for export
TclError = _tkinter.TclError
@@ -1827,7 +1827,11 @@ class Image:
def __str__(self): return self.name
def __del__(self):
if self.name:
- self.tk.call('image', 'delete', self.name)
+ try:
+ self.tk.call('image', 'delete', self.name)
+ except TclError:
+ # May happen if the root was destroyed
+ pass
def __setitem__(self, key, value):
self.tk.call(self.name, 'configure', '-'+key, value)
def __getitem__(self, key):