This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author korka
Recipients
Date 2007-04-17.08:29:04
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
These are a few examples of errors during code-reentry in the turtle module:

System tested: Windows XP sp2, Python 2.5

1. turtle.circle fails if the tkinter is closed while drawing.

# Code example:
import turtle
turtle.circle(100)
# close the tkinter window while the circle is drawing
# will give an "invalid command name" exception



2. using multiple inheritance, it's possible to draw more than 1 turtle running around at a time. This works part of the time, but crashes python completely on occasions.

# Code example:
import turtle, random
from threading import Thread

class Ninja(Thread, turtle.Turtle):
	'A ninja is a threaded turtle'
	
	def __init__(self):
		# constructors
		Thread.__init__(self)
		turtle.Turtle.__init__(self)
		
		# where will i go?
		self.Direction = random.randint(-180,180)
	
	def run(self):
		# that way!
		self.left(self.Direction)
		
		# march 'forward'
		for i in range(50):
			self.forward(16*random.random())
			self.left(22 - 45*random.random())




ninjas = []
for i in range(3):
	ninjas.append(Ninja())
	ninjas[-1].start()
History
Date User Action Args
2007-08-23 16:12:43adminlinkissue1702036 messages
2007-08-23 16:12:43admincreate