Python基础综合练习(五角星)

mport turtle

def mygoto(x,y):
    turtle.up()
    turtle.goto(x,y)
    turtle.down();

def drawwjx(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(-250,75)
drawwjx(100)

for i in range(4):
    x=1
    if i in[0,3]:
        x=0
    mygoto(-100+x*50,150-i*40)
    turtle.left(15-i*15)
    drawwjx(30)

mygoto(0,0)

turtle.hideturtle()
turtle.done()

  

 

posted @ 2018-03-20 15:21  205李华秋  阅读(174)  评论(0编辑  收藏  举报