import turtle def mygoto(x, y): turtle.up() turtle.goto(x, y) turtle.down() #自定义绘制五角星函数 def drowwjx(x): turtle.begin_fill() for i in range(5): turtle.forward(x) turtle.right(144) turtle.end_fill() turtle.setup(600,400,0,0) turtle.color("yellow") turtle.bgcolor("red") turtle.fillcolor("yellow") #绘制大五角星 mygoto(-275,95) drowwjx(100) #绘制四个小五角星 for i in range(4): x=1 turtle.right(5) if i in [0,3]: x=0 mygoto(-135+x*30,155-i*45) turtle.left(20-i*15) drowwjx(30) #隐藏画笔 turtle.hideturtle() turtle.done()