0

Wrong code for Turtle

Hi guys I'm having a problem with this code, hope someone help Import turtle Colors=['red', 'purple', 'blue', 'green', 'yellow', 'orange'] t=turtle. pen() Turtle.bgcolor(' black') For x in range(360): t.pencolor(colors[x%6]) #the error in this line t. width(x/100+1) t. forward(x) t. Left(59) When I give run it say Line 6 in module t.pencolor(colors[x%6]) AttributeError: 'dict' object has no attribute 'pencolor' Thanks for your help, I'm new in python

15th Oct 2016, 6:30 AM
Maher Al Sayid
Maher Al Sayid - avatar
2 Réponses
0
Setting "t = turtle.pen()" makes calling "t.pencolor()" to be "turtle.pen().pencolor()". Same for .width, .forward and .left. Edit "t = turtle.pen()" to become "t = turtle" and run your code again to enjoy the lovely swirling hexagon it draws :)
15th Oct 2016, 11:53 AM
John Otu
John Otu - avatar
0
Thanks John Otu, I figure it out it the pen have to be in big letter as (t=turtle.Pen()), How to save the shape that I get from the turtle after its finished?
15th Oct 2016, 12:01 PM
Maher Al Sayid
Maher Al Sayid - avatar