Bugs item #1702036, was opened at 2007-04-17 08:29
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&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.5
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()


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1702036&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to