Pycharm画五角星

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()

  

 

posted @ 2018-03-20 16:48  博威袁他就是袁威博  阅读(844)  评论(0编辑  收藏  举报