from turtle import * # setup(width=1.0, height=1.0) # same crash either way title("Experiment with Key Presses") setundobuffer(None) # same crash either way shape('turtle') vel = 5 # pixels per press or repeat def krt(): seth( 0); fd(vel) def kup(): seth( 90); fd(vel) def klt(): seth(180); fd(vel) def kdn(): seth(270); fd(vel) onkeypress(krt,'Right') onkeypress(kup,'Up') onkeypress(klt,'Left') onkeypress(kdn,'Down') listen() def gobye(x,y): bye() onscreenclick(gobye, 3) # exit with right click as well as close button mainloop() # Winxp, IDLE editor, F5-run: works and quits, but if move about 1000 times # MS VC++ Runtime Library runtime error pythonw.exe asked runtime to exit... # [click] pythonw has encounter error.... # and in IDLE shell window see following (multiple, first before crash) ''' Exception in Tkinter callback Traceback (most recent call last): File "C:\Programs\Python31\lib\tkinter\__init__.py", line 1399, in __call__ return self.func(*args) File "C:\Programs\Python31\lib\turtle.py", line 701, in eventfun fun() File "C:/Programs/Python31/turt/key.py", line 22, in kup def kup(): seth( 90); fd(vel) File "", line 1, in seth File "C:\Programs\Python31\lib\turtle.py", line 1933, in setheading self._rotate(angle) File "C:\Programs\Python31\lib\turtle.py", line 3274, in _rotate self._update() File "C:\Programs\Python31\lib\turtle.py", line 2657, in _update self._update_data() File "C:\Programs\Python31\lib\turtle.py", line 2648, in _update_data self._pencolor, self._pensize) File "C:\Programs\Python31\lib\turtle.py", line 547, in _drawline self.cv.itemconfigure(lineitem, fill=fill) File "", line 1, in itemconfigure File "C:\Programs\Python31\lib\tkinter\__init__.py", line 2229, in itemconfigure return self._configure(('itemconfigure', tagOrId), cnf, kw) File "C:\Programs\Python31\lib\tkinter\__init__.py", line 1171, in _configure cnf = _cnfmerge((cnf, kw)) File "C:\Programs\Python31\lib\tkinter\__init__.py", line 68, in _cnfmerge if isinstance(cnfs, dict): RuntimeError: maximum recursion depth exceeded while calling a Python object '''