1、画五角星
import turtle turtle.color('yellow') turtle.fillcolor('yellow') turtle.bgcolor('red') turtle.begin_fill() for i in range(5): turtle.forward(100) turtle.right(144) turtle.end_fill()
2、画同心圆
import turtle turtle.color('yellow') turtle.fillcolor('red') turtle.bgcolor('black') def pgoto(x,y): turtle.up() turtle.goto(x,y) turtle.down() turtle.begin_fill() for i in range(10): pgoto(0,0-(20*i)) turtle.circle(20*(i+1)) turtle.write(10-i) turtle.end_fill()
3、画太阳花
import turtle turtle.color('yellow') turtle.fillcolor('red') turtle.bgcolor('black') turtle.begin_fill() while True: turtle.forward(200) turtle.left(170) if(abs(turtle.pos()))<1: break turtle.end_fill()
4、画五个五角星
import turtle turtle.color('yellow') turtle.fillcolor('yellow') turtle.bgcolor('red') j=-250 k=-250 def pgoto(x,y): turtle.up() turtle.goto(x,y) turtle.down() def drawwujiao(r): for i in range(5): turtle.forward(r) turtle.right(144) turtle.begin_fill() for i in range(4): pgoto(j+(i*150),k+(i*150)) drawwujiao(100) turtle.end_fill() turtle.begin_fill() pgoto(-300,180) drawwujiao(250) turtle.end_fill()