-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTurtle.py
More file actions
67 lines (40 loc) · 999 Bytes
/
Copy pathTurtle.py
File metadata and controls
67 lines (40 loc) · 999 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import turtle
import random
# Settings
turtle.shape("classic")
turtle.speed("normal")
turtle.Screen().colormode(255)
turtle.Screen().bgcolor("#96a2f2")
radius = 50
x_loc = -420
y_loc = 290
def DrawAndFillCircle():
# Pick a random colour
r = random.randint(0, 255)
g = random.randint(0, 255)
b = random.randint(0, 255)
turtle.color(r, g, b)
# draw and fill circle
turtle.begin_fill()
turtle.circle(radius, 360)
turtle.end_fill()
#numCircles = int(input("Enter number of circles: "))
# Move to start position
turtle.penup()
turtle.goto(x_loc, y_loc)
turtle.pendown()
for j in range(5):
# Draw 1 Row
for i in range(5):
DrawAndFillCircle()
x_loc = x_loc + (radius * 2)
turtle.penup()
turtle.goto(x_loc, y_loc)
turtle.pendown()
# Move to the next row
y_loc = y_loc - (radius * 2)
x_loc = -420
turtle.penup()
turtle.goto(x_loc, y_loc)
turtle.pendown()
turtle.mainloop()