-
Notifications
You must be signed in to change notification settings - Fork 0
/
UZB_flag.py
147 lines (119 loc) · 2.3 KB
/
UZB_flag.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
#The National Flag of Uzbekistan
from turtle import *
from math import *
def funk1(x, y, rang):
tt.pencolor(rang)
tt.fillcolor(rang)
tt.penup()
tt.speed(1*N)
tt.goto(x, y)
tt.pendown()
tt.pensize(n)
tt.begin_fill()
tt.speed(4*N)
tt.fd(250*n)
tt.right(90)
tt.fd(40*n)
tt.right(90)
tt.fd(250*n)
tt.right(90)
tt.fd(40*n)
tt.end_fill()
def funk2(x, y):
tt.pencolor('red')
tt.penup()
tt.speed(1*N)
tt.goto(x, y)
tt.pendown()
tt.speed(4*N)
tt.pensize(2.5*n)
tt.fd(250*n)
def yulduz(x, y):
tt.penup()
tt.speed(1*N)
a = 3*n
tt.goto(x, y+a)
tt.pencolor('white')
tt.fillcolor('white')
tt.pensize(1)
tt.pendown()
tt.begin_fill()
tt.right(144)
tt.goto(a*cos(radians(-54))+x, a*sin(radians(-54))+y)
tt.right(144)
tt.goto(a*cos(radians(162))+x, a*sin(radians(162))+y)
tt.right(144)
tt.goto(a*cos(radians(18))+x, a*sin(radians(18))+y)
tt.right(144)
tt.goto(a*cos(radians(234))+x, a*sin(radians(234))+y)
tt.right(144)
tt.goto(x, y+a)
tt.end_fill()
tt.left(36)
def main():
global tt, n, N
while True:
n = input("O'lchamni kiriting: ")
N = input("Tezlikni kiriting: ")
if n.isdigit() and N.isdigit():
n = float(n)/250
N = float(N)
break
else:
print("Xatolik. Qayta urinib ko'ring: ")
print('')
oyna = Screen()
oyna.bgcolor('black')
tt = Turtle()
tt.shape('turtle')
tt.shapesize(1.5, 1.5, 3)
tt.pencolor('white')
funk1(-125*n, 62.5*n, 'blue')
tt.right(90)
funk1(-125*n, 20*n, 'white')
tt.right(90)
funk1(-125*n, -22.5*n, 'green')
tt.right(90)
funk2(-125*n, 21.25*n)
funk2(-125*n, -21.5*n)
for i1 in range(3):
x, y = -31*n, 30.5*n + i1*12*n
for i2 in range(5-i1):
yulduz(x, y)
x -= 12*n
tt.penup()
tt.goto(-90*n, 42.5*n)
tt.hideturtle()
tt1 = Turtle()
tt2 = Turtle()
tt1.penup()
tt2.penup()
tt1.speed(0)
tt2.speed(0)
tt1.color('white')
tt1.goto(-95*n, 42.5*n)
tt2.goto(-90*n, 42.5*n)
tt1.shape('circle')
tt2.shape('circle')
tt1.shapesize(1.5*n)
tt2.color('blue')
tt2.shapesize(1.25*n)
tt.showturtle()
tt.right(72)
tt.goto(600, 0)
#tt.hideturtle()
tt3 = Turtle()
tt3.speed(5)
tt3.hideturtle()
tt3.penup()
tt3.goto(-127*n, 64.5*n)
tt3.pendown()
tt3.pensize(4.5*n)
tt3.goto(127*n, 64.5*n)
tt3.goto(127*n, -64.5*n)
tt3.goto(-127*n, -64.5*n)
tt3.goto(-127*n, 64.5*n)
tt.hideturtle()
oyna.mainloop()
input()
main()