[Tutor] error in using TurtleWorld modules, ThinkPython.org Book

Surya P.K. Kasturi kasturisurya at gmail.com
Sun Jul 17 09:42:53 CEST 2011


I am using Think Python book, <www.ThinkPython.org> to learn python.
There is a module TurtleWorld that they described to draw lines <
http://www.greenteapress.com/thinkpython/swampy/install.html>

Though I could run the below code in the python shell, I couldn't do it
through a script file.


This is the script :

from TurtleWorld import *

world = TurtleWorld
bob = Turtle()
print bob

fd(bob, 100)
lt(bob)
fd(bob, 100)
lt(bob)
fd(bob, 100)
lt(bob)
fd(bob, 100)

wait_for_user()

*This is the following error I got at terminal :*

<TurtleWorld.Turtle object at 0xb770a50c>
Traceback (most recent call last):
  File "turtle.py", line 7, in <module>
    fd(bob, 100)
  File "/usr/local/lib/python2.6/dist-packages/TurtleWorld.py", line 187, in
fd
    self.world.canvas.line([p1, p2], fill=self.pen_color)
AttributeError: 'NoneType' object has no attribute 'canvas'

*Could you help me to fix this error, please!*
*
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110717/91e27b4b/attachment.html>


More information about the Tutor mailing list