-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathsquid_game_triangle_candy.py
More file actions
65 lines (59 loc) · 1.52 KB
/
squid_game_triangle_candy.py
File metadata and controls
65 lines (59 loc) · 1.52 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
56
57
58
59
60
61
62
63
64
65
import turtle
def draw_circle():
# Draw the outer circle of the candy with a thick border.
turtle.penup()
turtle.goto(0, -150)
turtle.pendown()
turtle.pensize(3)
turtle.color("#5a430c", "#c8a646")
turtle.begin_fill()
turtle.circle(150)
turtle.end_fill()
def draw_outer_circle():
# Draw the container for the candy.
turtle.penup()
turtle.goto(0, -180)
turtle.pendown()
turtle.pensize(6)
turtle.color("#a7c3c7", "#bfcacc")
turtle.begin_fill()
turtle.circle(180)
turtle.end_fill()
def draw_triangle():
# Draw a larger triangle in the center of the candy with a thick border.
turtle.penup()
turtle.goto(-80, -50)
turtle.pendown()
turtle.pensize(5)
turtle.color("#5a430c", "#cfb659")
turtle.begin_fill()
for _ in range(3):
turtle.forward(160)
turtle.left(120)
turtle.end_fill()
def draw_needle():
# Draw a needle inside the candy container.
turtle.penup()
turtle.goto(-70, -70)
turtle.pendown()
turtle.pensize(5)
turtle.color("gray")
turtle.setheading(45)
turtle.forward(220)
turtle.backward(220)
turtle.setheading(135)
turtle.forward(10)
turtle.backward(10)
def draw_candy():
# Draw the complete candy.
turtle.speed(3)
turtle.hideturtle()
draw_outer_circle()
draw_circle()
draw_triangle()
draw_needle()
if __name__ == "__main__":
screen = turtle.Screen()
screen.bgcolor("#fffaf0")
draw_candy()
screen.mainloop()