Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4b6ea79

Browse files
committed
Don't rename Tkinter to Tk; closes bug 115714
Subclass Error from Exception.
1 parent 145f96e commit 4b6ea79

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Lib/lib-tk/turtle.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
from math import * # Also for export
44
import Tkinter
5-
Tk = Tkinter
6-
Error = Exception
5+
class Error(Exception):
6+
pass
77

88
class RawPen:
99

@@ -85,7 +85,7 @@ def color(self, *args):
8585
# Test the color first
8686
try:
8787
id = self._canvas.create_line(0, 0, 0, 0, fill=color)
88-
except Tk.TclError:
88+
except Tkinter.TclError:
8989
raise Error, "bad color string: %s" % `color`
9090
self._color = color
9191
return
@@ -222,7 +222,7 @@ def _goto(self, x1, y1):
222222
self._canvas.update()
223223
self._canvas.after(10)
224224
self._canvas.itemconfigure(item, arrow="none")
225-
except Tk.TclError:
225+
except Tkinter.TclError:
226226
# Probably the window was closed!
227227
return
228228
else:
@@ -242,11 +242,11 @@ class Pen(RawPen):
242242
def __init__(self):
243243
global _root, _canvas
244244
if _root is None:
245-
_root = Tk.Tk()
245+
_root = Tkinter.Tk()
246246
_root.wm_protocol("WM_DELETE_WINDOW", self._destroy)
247247
if _canvas is None:
248248
# XXX Should have scroll bars
249-
_canvas = Tk.Canvas(_root, background="white")
249+
_canvas = Tkinter.Canvas(_root, background="white")
250250
_canvas.pack(expand=1, fill="both")
251251
RawPen.__init__(self, _canvas)
252252

0 commit comments

Comments
 (0)