Neil wrote:
Forgot to say, that after the error message the turtle window 'hangs' as
unresponsive ...
"Neil" <rubik_wiz...@no.spamhotmail.com> wrote in message
news:ifidnr_gysdmfqhunz2dnekdnzzin...@bt.com...
Hello
I am hoping to use Python to teach a class and have been looking at the
online book 'Snake Wrangling for Kids'.
I have followed the example
import turtle
t=turtle.pen()
which works fine and displays a turtle in a window.
However whenever I try to use something like
t.forward(50) (taken from the book)
i get the error...
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
t.forward(50)
AttributeError: 'dict' object has no attribute 'forward'
Well, if you
>>> print(turtle.__doc__)
You'll see that this is a re-implemetation, so expect a few hiccups.
I see, from the following:
>>> import turtle
>>> t = turtle.pen()
>>> print(repr(t))
The pen returned (which you named t) is a simple dictionary.
You can, however, follow up with:
>>> turtle.forward(23)
>>> turtle.right(90)
>>> turtle.forward(32)
>>> turtle.right(90)
>>> turtle.forward(23)
>>> turtle.right(90)
>>> turtle.forward(32)
Or, if you prefer, you can go:
>>> t = turtle.Turtle()
>>> t.forward(30)
>>> t.left(120)
--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list