diff options
author | Guido van Rossum <guido@python.org> | 1998-10-24 16:38:38 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-10-24 16:38:38 (GMT) |
commit | d4103883f3e556e3d903515eab79fb77413ebb75 (patch) | |
tree | 5b72952da5c561ce49af0f42e096a593d90bab1e /Tools | |
parent | 5ac15bc9c82b8d3d32402f733197c8f1e78892f3 (diff) | |
download | cpython-d4103883f3e556e3d903515eab79fb77413ebb75.zip cpython-d4103883f3e556e3d903515eab79fb77413ebb75.tar.gz cpython-d4103883f3e556e3d903515eab79fb77413ebb75.tar.bz2 |
Raise the root window on reset().
Different action on WM_DELETE_WINDOW is more likely to do the right thing,
allowing us to destroy old windows.
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/idle/turtle.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/Tools/idle/turtle.py b/Tools/idle/turtle.py index 9aa0835..9b4b91b 100644 --- a/Tools/idle/turtle.py +++ b/Tools/idle/turtle.py @@ -39,6 +39,7 @@ class RawPen: self._path = [] self._tofill = [] self.clear() + canvas._root().tkraise() def clear(self): self.fill(0) @@ -242,25 +243,22 @@ class Pen(RawPen): global _root, _canvas if _root is None: _root = Tk.Tk() - _root.wm_protocol("WM_DELETE_WINDOW", self.destroy) + _root.wm_protocol("WM_DELETE_WINDOW", self._destroy) if _canvas is None: # XXX Should have scroll bars _canvas = Tk.Canvas(_root, background="white") _canvas.pack(expand=1, fill="both") RawPen.__init__(self, _canvas) - def destroy(self): + def _destroy(self): global _root, _canvas, _pen - self.clear() - if self is _pen: + root = self._canvas._root() + if root is _root: _pen = None - root = _root; _root = None - canvas = _canvas; _canvas = None - if root: - try: - root.destroy() - except Tk.TclError: - pass + _root = None + _canvas = None + root.destroy() + def _getpen(): global _pen |