第一次尝试用turtle画图,很艰难、不完美但十分具有纪念意义!
希望可以和各位多多交流,共同进步!
#五星红旗
import turtle
turtle.speed(10)
turtle.hideturtle() #隐藏图标
turtle.pencolor("red")
#外框
turtle.penup()
turtle.goto(-300, 200)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("red")
turtle.fd(600)
turtle.right(90)
turtle.fd(400)
turtle.right(90)
turtle.fd(600)
turtle.right(90)
turtle.fd(400)
turtle.right(90)
turtle.end_fill()
turtle.pencolor("yellow")
#大星星
turtle.penup()
turtle.goto(-275, 115)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("yellow")
turtle.forward(90)
turtle.right(144)
turtle.forward(90)
turtle.right(144)
turtle.forward(90)
turtle.right(144)
turtle.forward(90)
turtle.right(144)
turtle.forward(90)
turtle.end_fill()
#小星星1
turtle.seth(0)
turtle.left(25)
turtle.penup()
turtle.goto(-187, 169)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("yellow")
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.end_fill()
#小星星2
turtle.penup()
turtle.goto(-275, 115)
turtle.pendown()
turtle.seth(0)
turtle.left(21)
turtle.penup()
turtle.goto(-147, 133)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("yellow")
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.end_fill()
#小星星3
turtle.penup()
turtle.goto(-275, 115)
turtle.pendown()
turtle.seth(0)
turtle.right(21)
turtle.penup()
turtle.goto(-147, 93)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("yellow")
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.end_fill()
#小星星4
turtle.penup()
turtle.goto(-275, 115)
turtle.pendown()
turtle.seth(0)
turtle.right(25)
turtle.penup()
turtle.goto(-187, 41)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("yellow")
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.end_fill()