Pycharm画五角星

时间:2023-03-08 16:36:44
import turtle

turtle.setup(600,400,0,0)
turtle.bgcolor('red')
turtle.color('yellow')
turtle.fillcolor('yellow') def mygoto(x,y):
turtle.up()
turtle.goto(x,y)
turtle.down() def draw(l):
turtle.begin_fill()
for i in range(5):
turtle.forward(l)
turtle.right(144)
turtle.end_fill() mygoto(-250,100)
draw(100) for i in range(4):
x=1
if i in [0,3]:
x=0
mygoto(-100+x*50,150-i*47)
turtle.left(15-i*15)
draw(30) mygoto(0,0)
turtle.hideturtle()
# print(time.clock()) turtle.done()

  Pycharm画五角星