标签:raw port img nbsp ide draw style imp blog
a.画五角星
import turtle for i in range(5): turtle.forward(100) turtle.right(144)
b.画同心圆
from turtle import* for i in range(5): up() goto(0,-20*(1+i)) down() circle(20*(1+i))
c.画太阳花
from turtle import* color(‘pink‘,‘yellow‘) begin_fill() while True: forward(200) right(150) if(abs(pos()))<1: break end_fill() hideturtle()
d.画五个角星
import turtle turtle.setup(600,400,0,0) turtle.color(‘yellow‘) turtle.bgcolor(‘red‘) turtle.fillcolor(‘yellow‘) def lsw_goto(x,y): turtle.up() turtle.goto(x,y) turtle.down() def lsw_draw5(r): turtle.begin_fill() for i in range(5): turtle.forward(r) turtle.right(144) turtle.end_fill() lsw_goto(-250,80) lsw_draw5(100) lsw_goto(-150,150) lsw_draw5(50) lsw_goto(-100,100) lsw_draw5(50) lsw_goto(-90,45) lsw_draw5(50) lsw_goto(-150,5) lsw_draw5(50) turtle.hideturtle()
e.画◇花瓣的太阳花
import turtle turtle.color(‘yellow‘,‘blue‘) turtle.bgcolor(‘pink‘) turtle.begin_fill() for i in range(1,37): turtle.forward(200) turtle.right(45) turtle.forward(200) turtle.right(135) turtle.forward(200) turtle.right(45) turtle.forward(200) turtle.right(135) turtle.left(10) turtle.speed("fastest") turtle.right(90) turtle.forward(500) turtle.end_fill() turtle.hideturtle()
标签:raw port img nbsp ide draw style imp blog
原文地址:http://www.cnblogs.com/zsy-97/p/7515530.html