国旗

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

  

原文地址:https://www.cnblogs.com/polvem/p/8610544.html