-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
55 lines (36 loc) · 1.04 KB
/
main.py
File metadata and controls
55 lines (36 loc) · 1.04 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from turtle import Turtle, Screen
import random
import turtle as t
tim = Turtle()
# colours =["light sky blue", "dark slate blue", "medium spring green", "tomato", "gold", "pink", "midnight blue"]
t.colormode(255)
directions = [0, 90, 180, 270]
tim.speed("fastest")
def random_color():
r = random.randint(0,255)
g = random.randint(0,255)
b = random.randint(0,255)
color = (r, g, b)
return color
def draw_spirograph(sizee_of_gap):
for _ in range(int(360 / sizee_of_gap)):
tim.color(random_color())
tim.circle(100)
tim.setheading(tim.heading() + sizee_of_gap)
draw_spirograph(10)
# def draw_shape(num_sides):
# angle = 360 /num_sides
# for _ in range(num_sides):
# tim.forward(100)
# tim.right(angle)
#
#
# for shape_side_n in range (3, 11):
# tim.begin_fill()
# tim.color(random.choice(colours))
# tim.fillcolor(random.choice(colours))
# draw_shape(shape_side_n)
# for _ in range (3,11):
# tim.end_fill()
screen = Screen()
screen.exitonclick()