-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathislam and a flower using turtle module.py
126 lines (112 loc) · 2.54 KB
/
islam and a flower using turtle module.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
#Author: Islam Youssief Mohamed
import turtle
import random
#This function is used to create the main window
def main():
window = turtle.Screen()
window.bgcolor("black")
abc =turtle.Turtle()
abc.shape("arrow")
abc.speed(2)
createNames(abc)
drawFlower(abc)
window.exitonclick()
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""
#This function is used to draw the name
def createNames(abc):
#for alphabet I
abc.pensize(5)
abc.color('red')
abc.fillcolor(1,1,0)
abc.pu()
abc.setx(-80)
abc.left(90)
abc.pd()
abc.fd(170)
abc.pu()
abc.fd(20)
abc.pd()
abc.dot(25,'red')
abc.pu()
#for alphabet S
abc.color("orange")
abc.setpos(0,100)
abc.pd()
abc.left(250)
abc.circle(50,-270)
abc.pu()
abc.setpos(0,100)
abc.pd()
abc.left(100)
abc.circle(50,-270)
#for alphabet L
abc.color("blue")
abc.pu()
abc.setpos(100,200)
abc.pd()
abc.left(180)
abc.bk(200)
abc.right(70)
abc.fd(50)
x = abc.xcor()
y = abc.ycor()
print(x,y)
#for alphabet A
abc.color("green")
abc.pu()
abc.setpos(127,13.457)
abc.pd()
abc.seth(0)
abc.left(70)
abc.forward(200)
abc.right(150)
abc.forward(200)
x = abc.xcor()
print(x)
abc.right(180)
abc.forward(80)
abc.seth(180)
abc.forward(62)
#for alphabet M
abc.color("yellow")
abc.pu()
abc.setpos(x+10,0)
abc.pd()
abc.seth(90)
abc.forward(200)
abc.right(165)
abc.forward(150)
abc.left(150)
abc.forward(150)
abc.seth(270)
abc.forward(200)
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
#This function is used to draw the flower
def drawFlower(abc):
abc.shape("classic")
abc.color("#DE0CF5")
abc.speed(10)
abc.pu()
abc.setpos(-200,0)
abc.pd()
for i in range(36):
x=str(random.randint(0,999999))
if len(x)<6 :
abc.color("#DE0CF5")
else:
abc.color("#"+x)
abc.left(35)
abc.forward(50)
abc.right(35)
abc.forward(50)
abc.right(145)
abc.forward(50)
abc.right(35)
abc.forward(50)
abc.right(10)
abc.color("#DE0CF5")
abc.seth(270)
abc.forward(200)
#""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if __name__=='__main__':
main()