本文摘自php中文网,作者angryTom,侵删。
本篇文章介绍了python使用turtle库绘制四叶草的方法,代码很简单,希望对学习python的朋友有帮助。

python绘图四叶草
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 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绘图四叶草的详细内容,更多文章请关注木庄网络博客!!
相关阅读 >>
什么是Python中唯一的映射类型
3分钟写出你的第一个Python程序
pickle库的使用详解
Python是编译型语言吗
Python之中正则表达式详解(实例分析)
Python可以开发安卓app吗
Python线程中同步锁详解
Python怎么打印字符
Python实现合并同一个文件夹下所有txt文件的方法
如何安装Python包
更多相关阅读请进入《Python》频道 >>
人民邮电出版社
python入门书籍,非常畅销,超高好评,python官方公认好书。
转载请注明出处:木庄网络博客 » python绘图四叶草