Feature Requests item #1702036, was opened at 2007-04-17 03:29 Message generated for change (Comment added) made by rhettinger You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1702036&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. >Category: Python Library >Group: Python 2.6 Status: Open Resolution: None Priority: 5 Private: No Submitted By: lomm (korka) Assigned to: Nobody/Anonymous (nobody) Summary: Turtle isn't thread-safe (crashes) Initial Comment: 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() ---------------------------------------------------------------------- >Comment By: Raymond Hettinger (rhettinger) Date: 2007-04-19 01:58 Message: Logged In: YES user_id=80475 Originator: NO As Josiah says, the current docs do not make any promises about thread-safety. So, this isn't a bug. That being said, it would be nice to offer a way to have multiple turtles running around under the control of different threads. ---------------------------------------------------------------------- Comment By: Josiah Carlson (josiahcarlson) Date: 2007-04-19 00:12 Message: Logged In: YES user_id=341410 Originator: NO Does Turtle claim to be thread safe in the documentation? Should we explicitly state that Turtle is not thread safe? Should we also say, "don't close the turtle window while it is drawing"? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1702036&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com