使用python中的turtle模块绘制五星红旗

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
import turtle
t = turtle.Pen()
def ():
t.color("red")
t.begin_fill()
for x in range (0,4):
if x % 2 == 0:
t.forward(300)
t.left(90)
else:
t.forward(200)
t.left(90)
t.end_fill()
def yl_Star(size): #黄色五角星星
t.begin_fill()
for i in range(0,4):
t.forward(int(size))
t.left(216)
t.end_fill()
def Big_Star_Move(x=-30,y=150,size=10): #移动画笔
t.up()
t.goto(x,y)
t.color("yellow")
t.forward(size)
t.down()
def Five_Star(): #接着画五个星星
Big_Star_Move(size=50)
yl_Star(70)
Big_Star_Move(135,155)
yl_Star(28)
Big_Star_Move(130,165)
yl_Star(28)
Big_Star_Move(110,83)
yl_Star(28)
Big_Star_Move(110,90)
yl_Star(28)
Big_Star_Move(0,0,0)
Background()
Five_Star()
turtle.mainloop()