本篇文章介绍了python使用turtle库绘制四叶草的方法,代码很简单,希望对学习python的朋友有帮助。 python绘图四叶草 import turtledef draw_shapes(): window = turtle.Screen() window.bgcolor(red) flower = tur
python绘图四叶草
import turtle def 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绘图四叶草的详细内容,更多请关注自由互联其它相关文章!