-
Notifications
You must be signed in to change notification settings - Fork 38
/
nigerian-flag.py
113 lines (93 loc) · 1.71 KB
/
nigerian-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
from turtle import *
import time
t = Turtle()
t.speed(8000)
bgcolor('black')
t.color('white')
t.pencolor('white')
t.pensize(2)
title("Nigerian Flag ")
t.up()
t.goto(-200,50)
t.down()
t.left(90)
flag_width , flag_height = 300, 150
# t.pencolor('white')
t.fillcolor('green')
t.begin_fill()
for i in range(2):
t.forward(flag_height)
t.right(90)
t.forward(flag_width)
t.right(90)
t.end_fill()
t.up()
t.forward(flag_height)
t.right(90)
t.forward(flag_width/3)
t.down()
# now drawing the white part of the flag
t.fillcolor('white')
t.begin_fill()
for i in range(2):
t.forward(flag_width/3)
t.right(90)
t.forward(flag_height)
t.right(90)
t.end_fill()
t.up()
t.forward(flag_width * 2/3)
t.down()
# start drawing the flagpole
t.pensize(1)
t.fillcolor("#222")
t.begin_fill()
t.right(90)
t.circle(10, -180)
t.backward(flag_height * 3)
t.circle(10, -180)
t.right(180)
t.forward(flag_height *3)
t.end_fill()
t.backward(80)
for i in range(8):
t.right(90)
t.forward(20)
t.right(90)
t.forward(3)
t.right(90)
t.forward(20)
t.right(90)
t.backward(3)
t.backward(150)
for i in range(8):
t.right(90)
t.forward(20)
t.right(90)
t.forward(3)
t.right(90)
t.forward(20)
t.right(90)
t.backward(3)
t.up()
t.goto(-220,-180)
t.down()
t.pencolor('white')
t.pensize(19)
t.write("THE NIGERIAN FLAG", font= ('Algerian', 22, 'bold'), align='left')
t.up()
t.backward(20)
t.right(90)
t.fd(100)
t.left(90)
t.backward(30)
t.shapesize(2,2)
t.color('white')
t.down()
shape_dict = ['arrow', 'turtle', 'circle', 'square', 'triangle', 'classic']
t.speed(.1)
while True:
for shape in shape_dict:
t.shape(shape)
time.sleep(.4)
done()