- 画五角星
import turtle
turtle.color('yellow')
turtle.bgcolor('red')
turtle.fillcolor('yellow')
def lh_star(r):
turtle.begin_fill()
for i in range(5):
turtle.forward(r)
turtle.right(144)
turtle.end_fill()
lh_star(150) - 画同心圆
import turtle
for i in range(5):
turtle.up()
turtle.goto(0,-20*(i+1))
turtle.down()
turtle.circle(20+20*(i+1)) - 画太阳花
import turtle
turtle.color('black')
turtle.fillcolor('red')
turtle.begin_fill()
while True:
turtle.forward(200)
turtle.left(170)
if(abs(turtle.pos()))<1:
break
turtle.end_fill() - 画五个五角星
import turtle
turtle.color('yellow')
turtle.bgcolor('red')
turtle.fillcolor('yellow')
def lh_goto(x,y):
turtle.up()
turtle.goto(x,y)
turtle.down()
def lh_star(r):
turtle.begin_fill()
for i in range(5):
turtle.forward(r)
turtle.right(144)
turtle.end_fill()
lh_goto(-275,175)
lh_star(100)
lh_goto(-175,50)
lh_star(50)
lh_goto(-100,100)
lh_star(50)
lh_goto(-100,175)
lh_star(50)
lh_goto(-170,250)
lh_star(50)
turtle.hideturtle() -
import turtle
turtle.color('white')
turtle.bgcolor('black')
turtle.speed(10)
def lh_ling(a):
for i in range(2):
turtle.forward(a)
turtle.right(30)
turtle.forward(a)
turtle.right(150)
for i in range(36):
lh_ling(50)
turtle.left(170)
turtle.goto(0,-150)
turtle.hideturtle()