python绘图四叶草
本篇文章介绍了python使用turtle库绘制四叶草的方法,代码很简单,希望对学习python的朋友有帮助。
python绘图四叶草
import turtledef draw_shapes(): window = turtle.Screen() window.bgcolor("red") flower = turtle.Turtle() flower.speed(10) flower.shape("arrow") flower.right(45) for i in range(1,37): for j in range(1,5): draw_circle(flower,i,"green") flower.left(90) flower.right(45) flower.color("green") flower.forward(500) window.exitonclick()def draw_circle(circle,radius,color): circle.color(color) circle.circle(radius)draw_shapes()
效果图:
众多python培训视频,尽在python学习网,欢迎在线学习!
立即学习“Python免费学习笔记(深入)”;