forked from Future423/Python-codes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHappy_Birthday_In_Python(turtle).py
More file actions
89 lines (75 loc) · 1.63 KB
/
Happy_Birthday_In_Python(turtle).py
File metadata and controls
89 lines (75 loc) · 1.63 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#A python code for wishing "Happy Birthday"
import turtle
import random
bg = turtle.Screen()
bg.bgcolor("black")
turtle.penup()
turtle.goto(-170,-180)
turtle.color("white")
turtle.pendown()
turtle.forward(330)
turtle.penup()
turtle.goto(-160,-150)
turtle.color("white")
turtle.pendown()
turtle.forward(305)
turtle.penup()
turtle.goto(-150,-120)
turtle.color("white")
turtle.pendown()
turtle.forward(280)
turtle.penup()
turtle.goto(-100,-100)
turtle.color("pink")
turtle.begin_fill()
turtle.pendown()
turtle.forward(140)
turtle.left(90)
turtle.forward(95)
turtle.left(90)
turtle.forward(140)
turtle.left(90)
turtle.forward(95)
turtle.end_fill()
turtle.penup()
turtle.goto(-90,0)
turtle.color("red")
turtle.left(180)
turtle.pendown()
turtle.forward(20)
turtle.penup()
turtle.goto(-60,0)
turtle.color("blue")
turtle.pendown()
turtle.forward(20)
turtle.penup()
turtle.goto(-30,0)
turtle.color("yellow")
turtle.pendown()
turtle.forward(20)
turtle.penup()
turtle.goto(0,0)
turtle.color("green")
turtle.pendown()
turtle.forward(20)
turtle.penup()
turtle.goto(30,0)
turtle.color("orange")
turtle.pendown()
turtle.forward(20)
colors = ["red", "orange", "brown", "green", "blue", "purple", "grey"]
turtle.penup()
turtle.goto(-40,-50)
turtle.pendown()
for each_color in colors:
angle = 360 / len(colors)
turtle.color(each_color)
turtle.circle(10)
turtle.right(angle)
turtle.forward(10)
turtle.penup()
turtle.goto(-170, 50)
turtle.color("cyan")
turtle.pendown()
turtle.write("Happy Birthday To You!", font=("Verdana", 25, "normal"))
turtle.color("black")