import turtle
turtle.setup(650,400,200,200)
turtle.penup()
turtle.fd(-100)
#这是国旗外观正方形代码
turtle.pendown()
turtle.pensize(3)
turtle.pencolor("red")
turtle.color("red")
#设置画笔颜色/填充颜色为红色
turtle.fillcolor("red")
#填充颜色开始语句
turtle.begin_fill()
turtle.fd(400)
turtle.right(90)
turtle.fd(250)
turtle.right(90)
turtle.fd(400)
turtle.right(90)
turtle.fd(250)
turtle.right(90)
#填充颜色结束语句
turtle.end_fill()
#第一个小三角形
turtle.penup()
turtle.fd(80)
turtle.right(45)
turtle.fd(15)
turtle.pendown()
turtle.pensize(3)
turtle.pencolor("yellow")
turtle.fillcolor("yellow")
turtle.begin_fill()
for i in range(5):
turtle.fd(20)
turtle.right(144)
turtle.end_fill()
#第二个小三角形
turtle.penup()
turtle.right(-10)
turtle.fd(50)
turtle.pendown()
turtle.pensize(3)
turtle.pencolor("yellow")
turtle.fillcolor("yellow")
turtle.begin_fill()
for i in range(5):
turtle.fd(20)
turtle.right(144)
turtle.end_fill()
#第三个小五角星
turtle.penup()
turtle.right(40)
turtle.fd(50)
turtle.pendown()
turtle.pensize(3)
turtle.pencolor("yellow")
turtle.fillcolor("yellow")
turtle.begin_fill()
for i in range(5):
turtle.fd(20)
turtle.right(144)
turtle.end_fill()
#第四个小五角星
turtle.penup()
turtle.right(50)
turtle.fd(60)
turtle.pendown()
turtle.pensize(3)
turtle.pencolor("yellow")
turtle.fillcolor("yellow")
turtle.begin_fill()
for i in range(5):
turtle.fd(20)
turtle.right(144)
turtle.end_fill()
#大五角星
turtle.penup()
turtle.right(90)
turtle.fd(35)
turtle.pendown()
turtle.pensize(3)
turtle.pencolor("yellow")
turtle.fillcolor("yellow")
turtle.begin_fill()
for i in range(5):
turtle.fd(90)
turtle.right(144)
turtle.end_fill()
turtle.done()
代码运行显示: