- 画五角星
import turtle
for i in range (5):
turtle.forward(100)
turtle.right(144) - 画同心圆
import turtle
for i in range (5):
turtle.up()
turtle.goto(0,-20*i+1)
turtle.down()
turtle.circle(20*i) - 画太阳花
import turtle
turtle.fillcolor('red')
turtle.begin_fill()
while True:
turtle.forward(200)
turtle.right(100)
if(abs(turtle.pos()))<1:
break
turtle.end_fill()
turtle.hideturtle() - 画五个五角星
import turtle
turtle.speed('fastest')
turtle.setup(700,500,0,0)
turtle.fillcolor('yellow')
turtle.color('yellow')
turtle.bgcolor('red')
def my_goto(x,y):
turtle.up()
turtle.goto(x,y)
turtle.down()
def my_draw1(r):
turtle.begin_fill()
for i in range(5):
turtle.forward(r)
turtle.right(144)
turtle.end_fill()
my_goto(-300,75)
my_draw1(100)
my_goto(-225,170)
turtle.left(50)
my_draw1(50)
my_goto(-150,93)
turtle.left(44)
my_draw1(50)
my_goto(-120,0)
turtle.left(50)
my_draw1(50)
my_goto(-180,-50)
turtle.left(50)
my_draw1(50)5. 画◇花瓣的太阳花
import turtle
turtle.color('orange')
turtle.bgcolor('purple')
for i in range(1,73):
turtle.speed('fastest')
turtle.left(10)
turtle.forward(100)
turtle.right(45)
turtle.forward(100)
turtle.right(135)
turtle.forward(100)
turtle.right(45)
turtle.forward(100)