1.导入海龟库
import turtle
2.绘制旗面
##绘制旗面
turtle.penup()
turtle.goto(-300,-200)
turtle.pendown()
turtle.color("red")
turtle.begin_fill()
turtle.forward(600)
turtle.left(90)
turtle.forward(400)
turtle.left(90)
turtle.forward(600)
turtle.left(90)
turtle.forward(400)
turtle.left(90)
turtle.end_fill()
3.绘制大五角星
turtle.color("gold")
turtle.begin_fill()
turtle.penup()
turtle.goto(-260,120)
turtle.pendown()
for i in range(5):
turtle.forward(120)
turtle.right(144)
turtle.end_fill()
4.绘制第一个小五角星
turtle.color("gold")
turtle.begin_fill()
turtle.penup()
turtle.goto(-120,160)
turtle.pendown()
for i in range(5):
turtle.forward(40)
turtle.right(144)
turtle.end_fill()
5.绘制第二个小五角星
##第二个小五角星
turtle.color("gold")
turtle.begin_fill()
turtle.penup()
turtle.goto(-80,120)
turtle.pendown()
for i in range(5):
turtle.forward(40)
turtle.right(144)
turtle.end_fill()
6.绘制第三个小五角星
turtle.color("gold")
turtle.begin_fill()
turtle.penup()
turtle.goto(-80,60)
turtle.pendown()
for i in range(5):
turtle.forward(40)
turtle.right(144)
turtle.end_fill()
7.绘制第四个小五角星
turtle.color("gold")
turtle.begin_fill()
turtle.penup()
turtle.goto(-120,20)
turtle.pendown()
for i in range(5):
turtle.forward(40)
turtle.right(144)
turtle.end_fill()
8.隐藏画笔
turtle.hideturtle()
turtle.done()
9.完整代码
import turtle
##绘制旗面
turtle.penup()
turtle.goto(-300,-200)
turtle.pendown()
turtle.color("red")
turtle.begin_fill()
turtle.forward(600)
turtle.left(90)
turtle.forward(400)
turtle.left(90)
turtle.forward(600)
turtle.left(90)
turtle.forward(400)
turtle.left(90)
turtle.end_fill()
##大五角星
turtle.color("gold")
turtle.begin_fill()
turtle.penup()
turtle.goto(-260,120)
turtle.pendown()
for i in range(5):
turtle.forward(120)
turtle.right(144)
turtle.end_fill()
##第一个小五角星
turtle.color("gold")
turtle.begin_fill()
turtle.penup()
turtle.goto(-120,160)
turtle.pendown()
for i in range(5):
turtle.forward(40)
turtle.right(144)
turtle.end_fill()
##第二个小五角星
turtle.color("gold")
turtle.begin_fill()
turtle.penup()
turtle.goto(-80,120)
turtle.pendown()
for i in range(5):
turtle.forward(40)
turtle.right(144)
turtle.end_fill()
##第三个小五角星
turtle.color("gold")
turtle.begin_fill()
turtle.penup()
turtle.goto(-80,60)
turtle.pendown()
for i in range(5):
turtle.forward(40)
turtle.right(144)
turtle.end_fill()
##第四个小五角星
turtle.color("gold")
turtle.begin_fill()
turtle.penup()
turtle.goto(-120,20)
turtle.pendown()
for i in range(5):
turtle.forward(40)
turtle.right(144)
turtle.end_fill()
turtle.haideturtle()
turtle.done()