-
Notifications
You must be signed in to change notification settings - Fork 0
/
christmas.py
67 lines (58 loc) · 1.26 KB
/
christmas.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
from turtle import *
speed(0)
# Blue Background
penup()
goto(0, -250)
pendown()
color("lightskyblue")
begin_fill()
circle(250)
end_fill()
# Tree Trunk
penup()
goto(-15, -50)
pendown()
color("brown")
begin_fill()
for i in range(2):
forward(30)
right(90)
forward(40)
right(90)
end_fill()
# Set the start position and the inital tree width
y = -50
width = 240
height = 25
# Green section of tree (add in the greater than symbol next to the 20 - YouTube doesn't allow me to put in pointy brackets).
while width > 20:
width = width - 30 # Make the tree get smaller as it goes up in height
x = 0 - width / 2 # Set the starting x-value of each level of the tree
color("green")
penup()
goto(x, y)
pendown()
begin_fill()
for i in range(2):
forward(width)
left(90)
forward(height)
left(90)
end_fill()
y = y + height # Keep drawing the levels of the tree higher than the previous
# Star
penup()
goto(-15, 150)
pendown()
color("yellow")
begin_fill()
for i in range(5):
forward(30)
right(144)
end_fill()
# Message
penup()
goto(-130, -150)
color("red")
write("MERRY CHRISTMAS PROGRAMMING PYTHON!", font=("Arial", 20, "bold"))
hideturtle()