classification
Title: turtle: _tkinter.TclError: invalid command name ".10170160"
Type: behavior Stage: needs patch
Components: Library (Lib), Tkinter Versions: Python 3.2, Python 3.1, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: belopolsky, gregorlingl, ned.deily, srid
Priority: normal Keywords:

Created on 2009-08-04 00:09 by srid, last changed 2010-10-28 01:12 by ned.deily.

Messages (4)
msg91248 - (view) Author: Sridhar Ratnakumar (srid) Date: 2009-08-04 00:09
I tried the following turtle program; it was taking some time to 
draw .. so I pressed C-c after which I saw the exception traceback.

> cat play.py 
from turtle import *

def f(length, depth):
   if depth == 0:
     forward(length)
   else:
     f(length/3, depth-1)
     right(60)
     f(length/3, depth-1)
     left(120)
     f(length/3, depth-1)
     right(60)
     f(length/3, depth-1)

f(500, 4)

> python play.py
Traceback (most recent call last):
  File "/Users/sridharr/as/pypm/bin/python", line 41, in <module>
    execfile(sys.argv[0])
  File "play.py", line 15, in <module>
    f(500, 4)
  File "play.py", line 11, in f
    f(length/3, depth-1)
  File "play.py", line 7, in f
    f(length/3, depth-1)
  File "play.py", line 9, in f
    f(length/3, depth-1)
  File "play.py", line 10, in f
    left(120)
  File "<string>", line 1, in left
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
lib-tk/turtle.py", line 1612, in left
    self._rotate(angle)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
lib-tk/turtle.py", line 3107, in _rotate
    self._update()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
lib-tk/turtle.py", line 2562, in _update
    self._update_data()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
lib-tk/turtle.py", line 2553, in _update_data
    self._pencolor, self._pensize)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
lib-tk/turtle.py", line 569, in _drawline
    self.cv.coords(lineitem, *cl)
  File "<string>", line 1, in coords
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
lib-tk/Tkinter.py", line 2136, in coords
    self.tk.call((self._w, 'coords') + args)))
_tkinter.TclError: invalid command name ".10170160"
>
msg109949 - (view) Author: Mark Lawrence (BreamoreBoy) Date: 2010-07-11 00:03
Anyone with turtle/Tkinter knowledge who can shed some light on this?
msg119414 - (view) Author: Alexander Belopolsky (belopolsky) (Python committer) Date: 2010-10-23 03:06
I have come across the same bug.  To reproduce, run Demo/turtle/tdemo_round_dance.py and kill the Tk window before the "dance" stops. 

The mysterious command name ".10170160" is simply the generated name for the canvas widget - '.' + repr(id(self)).  See BaseWidget.__init__ in tkinter.
msg119711 - (view) Author: Alexander Belopolsky (belopolsky) (Python committer) Date: 2010-10-27 13:33
Same error occurs when the python -m turtle demo is interrupted by closing the window.  I think the correct fix is to exit when the window is closed, but I cannot figure out the best way to achieve that.  This probably should be done at the application/test level.
History
Date User Action Args
2010-11-05 02:08:18belopolskylinkissue1702036 superseder
2010-10-28 01:12:24ned.deilysetnosy: + ned.deily, - BreamoreBoy
2010-10-27 13:33:39belopolskysetnosy: + gregorlingl
messages: + msg119711
2010-10-23 03:06:02belopolskysetnosy: + belopolsky
messages: + msg119414
2010-07-11 00:03:53BreamoreBoysetversions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.6
nosy: + BreamoreBoy

messages: + msg109949

stage: needs patch
2009-08-04 00:09:40sridsetcomponents: + Tkinter
2009-08-04 00:09:24sridcreate