Reputation: 1
Here's my code
Import turtle
t = turtle.pen()
t.forward(50)
And this is the error I get
Traceback (most recent call last) :
File "<pyshell#4>", Line 1, in <module>
t.forward(50)
AttributeError: 'dict' object has no attribute 'forward'
Upvotes: -1
Views: 857
Reputation: 349
Turtle.pen is used to set/get pen attributes of turtle but not to draw(see help(turtle.pen) for more info), in order to draw something you need to get Turtle object as follow:
import turtle
tur=turtle.Turtle();
tur.forward(50);
Upvotes: 0