-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSnowman.py
218 lines (195 loc) · 3.02 KB
/
Snowman.py
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# Import Turtle module from Python Library
import turtle
from turtle import *
# Setting Turtle speed and screensize
speed(0.1)
window = turtle.Screen()
window.bgcolor("red")
turtle.hideturtle()
setup(800,600)
#Green background
penup()
goto(0,-320)
pendown()
color("green")
begin_fill()
circle(320)
end_fill()
#bottom of body
penup()
goto(0, -280)
pendown()
color("white")
begin_fill()
circle(110)
end_fill()
#middle of body
penup()
goto(0, -110)
pendown()
color("white")
begin_fill()
circle(90)
end_fill()
#head of body
penup()
goto(0, 20)
pendown()
color("white")
begin_fill()
circle(70)
end_fill()
# Function to draw 1 small black circle (to be called to make buttons later)
def black_circle():
color("black")
begin_fill()
circle(10)
end_fill()
# Draw eyes of the snowman
x= -20
for i in range(2):
penup()
goto(x, 110)
pendown()
black_circle() #We call the function to make circles
x = x + 40
# Draw buttons on the snowman (using function - black circle)
y = 0
for i in range(5):
penup()
goto(0, y)
pendown()
black_circle() #We call the function to make circles
y = y - 55
# Mouth of the snowman
penup()
goto(0, 70)
color("red")
begin_fill()
circle(17)
end_fill()
# Smaller mouth of the snowman
penup()
goto(0, 75)
color("white")
begin_fill()
circle(17)
end_fill()
# Create the right arm
penup()
goto(75,0)
pendown()
color("brown")
begin_fill()
left(40)
for i in range(2):
forward(75)
left(90)
forward(7)
left(90)
end_fill()
# Now create right finger 1
penup()
goto(115,38)
pendown()
color("brown")
begin_fill()
left(40)
for i in range(2):
forward(25)
left(90)
forward(5)
left(90)
end_fill()
# Now create right finger 2
goto(115,35)
begin_fill()
color("brown")
right(100)
for i in range(2):
forward(25)
left(90)
forward(5)
left(90)
end_fill()
# Now create left arm
penup()
goto(-130, 50)
pendown()
color("brown")
begin_fill()
right(10)
for i in range(2):
forward(75)
right(90)
forward(7)
right(90)
end_fill()
# Now create left finger 1
penup()
goto(-112, 58)
pendown()
color("brown")
begin_fill()
right(40)
for i in range(2):
forward(25)
right(90)
forward(5)
right(90)
end_fill()
# Now create left finger 2
penup()
goto(-108, 30)
pendown()
color("brown")
begin_fill()
right(100)
for i in range(2):
forward(25)
right(90)
forward(5)
right(90)
end_fill()
# Making the snowman hat
penup()
goto(50, 150)
pendown()
color("black")
begin_fill()
right(10)
forward(100)
right(90)
forward(10)
right(90)
forward(20)
left(90)
forward(45)
right(90)
forward(60)
right(90)
forward(45)
left(90)
forward(20)
right(90)
end_fill()
# Nose of the snowman
penup()
goto(-6, 95)
pendown()
color("red")
begin_fill()
circle(5)
end_fill()
# Write Merry Christmas on Screen
penup()
goto(-135, 240)
pendown()
color("white")
write("Merry Christmas!", font=("Kunstler Script", 40, "bold"))
penup()
goto(-110, 210)
write("The Langley Academy", font=("Kunstler Script", 22,"normal", ))
pendown()
# Prevent turtle window from closing
turtle.done()