import turtle #快速绘图
turtle.speed(10)#绘图速度
turtle.penup()#隐藏画笔画出的线
def draw_bluerectangle(start_x,start_y,len_x,len_y):#画蓝色框
turtle.goto(start_x,start_y)
turtle.color('black')
turtle.fillcolor('blue')
turtle.begin_fill()
for i in range(2):
turtle.forward(len_x)
turtle.right(90)
turtle.forward(len_y)
turtle.right(90)
turtle.end_fill()
def draw_redrectangle(start_x,start_y,len_x,len_y):#画红色框
for j in range(7):#画七条
turtle.goto(start_x,start_y)
turtle.color('black')
turtle.fillcolor('red')
turtle.begin_fill()
for i in range(2):#循环两次
turtle.forward(len_x)
turtle.right(90)
turtle.forward(len_y)
turtle.right(90)
start_y-=50
turtle.end_fill()
def draw_1star(x,y): #画奇数排星星
for k in range(5):#画五行
for j in range(6):#一行画六个星星
turtle.penup()
turtle.goto(x,y)
turtle.pendown()
turtle.color('white','white')
turtle.begin_fill()
for i in range(5):#画一个星星
turtle.forward(10)
turtle.right(144)
x=x+33.5
turtle.end_fill()
x-=33.5*6
y-=26
def draw_2star(x,y): #画偶数排星星
for k in range(4):#画四行
for j in range(5):#一行五个星星
turtle.penup()
turtle.goto(x,y)
turtle.pendown()
turtle.color('white','white')
turtle.begin_fill()
for i in range(5):#画一个星星
turtle.forward(10)
turtle.right(144)
x=x+33.5
turtle.end_fill()
x-=33.5*5
y-=26
print(draw_redrectangle(-320,270,420,25))#打印红色框
print(draw_bluerectangle(-320,270,200,125))#打印蓝色框
print(draw_1star(-311.5,257.5))#奇数排星星
print(draw_2star(-294.5,245))#偶数排星星
turtle.speed(10)#绘图速度
turtle.penup()#隐藏画笔画出的线
def draw_bluerectangle(start_x,start_y,len_x,len_y):#画蓝色框
turtle.goto(start_x,start_y)
turtle.color('black')
turtle.fillcolor('blue')
turtle.begin_fill()
for i in range(2):
turtle.forward(len_x)
turtle.right(90)
turtle.forward(len_y)
turtle.right(90)
turtle.end_fill()
def draw_redrectangle(start_x,start_y,len_x,len_y):#画红色框
for j in range(7):#画七条
turtle.goto(start_x,start_y)
turtle.color('black')
turtle.fillcolor('red')
turtle.begin_fill()
for i in range(2):#循环两次
turtle.forward(len_x)
turtle.right(90)
turtle.forward(len_y)
turtle.right(90)
start_y-=50
turtle.end_fill()
def draw_1star(x,y): #画奇数排星星
for k in range(5):#画五行
for j in range(6):#一行画六个星星
turtle.penup()
turtle.goto(x,y)
turtle.pendown()
turtle.color('white','white')
turtle.begin_fill()
for i in range(5):#画一个星星
turtle.forward(10)
turtle.right(144)
x=x+33.5
turtle.end_fill()
x-=33.5*6
y-=26
def draw_2star(x,y): #画偶数排星星
for k in range(4):#画四行
for j in range(5):#一行五个星星
turtle.penup()
turtle.goto(x,y)
turtle.pendown()
turtle.color('white','white')
turtle.begin_fill()
for i in range(5):#画一个星星
turtle.forward(10)
turtle.right(144)
x=x+33.5
turtle.end_fill()
x-=33.5*5
y-=26
print(draw_redrectangle(-320,270,420,25))#打印红色框
print(draw_bluerectangle(-320,270,200,125))#打印蓝色框
print(draw_1star(-311.5,257.5))#奇数排星星
print(draw_2star(-294.5,245))#偶数排星星