-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpirograph
More file actions
42 lines (25 loc) · 827 Bytes
/
Copy pathSpirograph
File metadata and controls
42 lines (25 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import random
import turtle as t
t.colormode(255)
dodo = t.Turtle()
#colors = ["Red", "Blue", "Green", "Black", "Purple", "Grey", "SeaGreen", "DarkOrchid", "IndianRed", "DeepSkyBlue"]
directions = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 120, 150, 160, 180, 270]
#we will give a random rgb value to it now
def random_color():
r = random.randint(0, 255)
g = random.randint(0, 255)
b = random.randint(0, 255)
random_color = (r, g, b)
return random_color
dodo.speed("fastest")
for i in range(100):
dodo.color(random_color())
dodo.circle(100)
dodo.setheading(dodo.heading() + 5)
#for i in range(200):
# #we are calling the method here
# dodo.color(random_color())
# dodo.forward(20)
# dodo.setheading(random.choice(directions))
screen = t.Screen()
screen.exitonclick()