国旗

import turtle

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

def drawStar(x):
    turtle.fillcolor("yellow")
    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(-260,120)
drawStar(100)


for i in range(4):
    x = 1
    if i in [0, 3]:
        x = 0
    mygoto(-120 + x * 45, 160 - i * 40)  # goto
    turtle.left(25 - i * 15)  # 转角度
    drawStar(40)  # draw

turtle.hideturtle()
turtle.done()

  

posted @ 2018-03-20 17:02  Polvem  阅读(109)  评论(0编辑  收藏  举报