python turtle工具绘制四叶草的实例分享
2020-03-17 12:04
591 查看
本篇文章介绍了python使用turtle库绘制四叶草的方法,代码很简单,希望对学习python的朋友有帮助。
import turtle import time turtle.setup(650.,350,200,200) turtle.pendown() turtle.pensize(10) turtle.pencolor('green') #四叶草 def draw_clover(radius,rotate): #参数radius控制叶子的大小,rotate控制叶子的旋转 for i in range(4): direction = i*90 turtle.seth(60+direction+rotate) #控制叶子根部的角度为60度 # turtle.fd(2*radius*pow(2,1/2)) #控制叶子根部的角度为90度 turtle.fd(4*radius) for j in range(2): turtle.seth(90+direction+rotate) turtle.circle(radius,180) turtle.seth(-60+direction+rotate) turtle.fd(4*radius) turtle.seth(-90) turtle.fd(6*radius) draw_clover(30,45) time.sleep(5)
内容扩展
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的turtle函数绘制一个滑稽表情
- Python如何使用turtle库绘制图形
- python使用turtle库绘制奥运五环
- 解决Python3.8用pip安装turtle-0.0.2出现错误问题
- 通过Turtle库在Python中绘制一个鼠年福鼠
- 使用python turtle画高达
- Python turtle画图库&&画姓名实例
- Python : turtle色彩控制实例详解
- Python使用turtle库绘制小猪佩奇(实例代码)
- python turtle 绘制太极图的实例
- 使用Python的Turtle库绘制森林的实例
- python 实现turtle画图并导出图片格式的文件
- 在Python中使用turtle绘制多个同心圆示例
- python 利用turtle模块画出没有角的方格
- Python turtle库绘制菱形的3种方式小结
- 用python的turtle模块实现给女票画个小心心
- python 利用turtle库绘制笑脸和哭脸的例子
- 使用python图形模块turtle库绘制樱花、玫瑰、圣诞树代码实例
相关文章推荐
- Python+Turtle动态绘制一棵树实例分享
- 【Python基础】1.4.3 Turtle库绘制多边形实例
- Python使用turtle库绘制小猪佩奇(实例代码)
- 使用Python的Turtle绘制哆啦A梦实例
- python图形工具turtle绘制国际象棋棋盘
- Python图形工具turtle绘制国际象棋棋盘
- python turtle 绘制太极图的实例
- 使用Python的Turtle库绘制森林的实例
- 使用python图形模块turtle库绘制樱花、玫瑰、圣诞树代码实例
- python turtle 海龟绘图,绘制小猪佩奇
- python制作英语翻译小工具代码实例
- 详解Python使用Plotly绘图工具,绘制甘特图
- python制作websocket服务器实例分享
- python图形绘制奥运五环实例讲解
- 利用Python的turtle库绘制玫瑰教程
- 编写Python爬虫抓取暴走漫画上gif图片的实例分享
- Python自动化测试工具Splinter简介和使用实例
- Python中Turtle绘图函数-绘制时钟程序
- Python使用turtle库与random库绘制雪花
- 使用python绘制二元函数图像的实例