When I try to do the following in python 2.7.8 shell:
>>> import turtle
>>> turtle.demo()
I get the following error:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
turtle.demo()
AttributeError: 'module' object has no attribute 'demo'
This is the first time in my life I try using turtle, and assumed it would be installed when installing python. I can't find it anywhere on my computer and don't know how to get it at the correct place. Can anybody please explain what I have to do to get at least the turtle.demo() working?
Since demo1()
and demo2()
are defined under a if __name__ == "__main__":
statement, don't try to run them from inside a Python shell, instead run the turtle.py library as if it were a standalone Python program:
python C:\Python27\Lib\lib-tk\turtle.py
that should invoke the two demonstration routines, one after the other. Worth watching just to see the undo feature in action.