-
Notifications
You must be signed in to change notification settings - Fork 0
/
TurtleSnowman.py
122 lines (105 loc) · 1.98 KB
/
TurtleSnowman.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
import turtle
# drawBase = draw the base of the snowman, the largest snowball at the bottom
# drawMidSection = draw the middle snowball
# drawArms = draw snowman arms
# drawHead = draw snowman head, with eyes/mouth/ect
# drawHat = draw snowman hat
# Make it faster than typing out "Tutrle"
t = turtle
# X and Y coords for circles
MID_X = 0
MID_Y = 25
HEAD_X = 0
HEAD_Y = 100
HAT_X = 10
HAT_Y = 190
def main():
drawBase()
drawMidSection()
drawHead()
drawArms()
drawHat()
def drawBase():
t.penup()
t.setx(0.0)
t.sety(-250)
t.pendown()
t.circle(100)
def drawMidSection():
t.penup()
t.setx(0.0)
t.sety(-50)
t.pendown()
t.circle(75)
def drawHead():
t.penup()
t.setx(0.0)
t.sety(100)
t.pendown()
t.circle(50)
t.penup()
t.setx(-30)
t.sety(125)
t.pendown()
t.forward(60)
t.penup()
t.goto(HEAD_X, HEAD_Y)
t.setx(-30)
t.sety(150)
t.pendown()
t.circle(5)
t.penup()
t.forward(60)
t.pendown()
t.circle(5)
t.penup()
def drawArms():
t.penup()
t.setx(MID_X)
t.sety(MID_Y)
t.forward(75)
t.pendown()
t.left(30)
t.forward(50)
t.left(20)
t.forward(20)
t.back(20)
t.right(40)
t.forward(20)
t.penup()
t.goto(MID_X, MID_Y)
t.left(170)
t.forward(75)
t.pendown()
t.right(30)
t.forward(50)
t.right(20)
t.forward(20)
t.back(20)
t.left(40)
t.forward(20)
t.penup()
def drawHat():
t.goto(HAT_X, HAT_Y)
t.back(40)
t.setheading(180)
t.pendown()
t.begin_fill()
t.forward(100)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(40)
t.right(90)
t.forward(61)
t.right(90)
t.forward(40)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.end_fill()
main()
turtle.done()