使用python的turtle绘画滑稽脸实例


Posted in Python onNovember 21, 2019

这是借鉴了一位兄弟的代码,然后进行修改的,原来代码存在问题,用了2小时,自己修改,终于画出了滑稽脸,也算是对于今天学的turtle绘画库的一个小小的记录吧!(有错误希望各位看官指正啊)

编译器是:Atom

python 是3.7版本

运行位 Windows power shell

import turtle
turtle.setup(600,600,200,200)

#fcae
turtle.penup()
turtle.goto(-210,0)
turtle.seth(-90)
turtle.pendown()
turtle.pencolor(‘orange')
turtle.pensize(4)
turtle.begin_fill()
turtle.circle(210,360)
turtle.fillcolor(‘yellow')
turtle.end_fill()
turtle.pencolor(‘black')

#mouth
turtle.pensize(5)
turtle.penup()
turtle.goto(-150,30)
turtle.pendown()
turtle.seth(-90)
turtle.circle(150,180)

#left eye
turtle.penup()
turtle.pensize(4)
turtle.goto(-180,90)
turtle.pendown()
turtle.seth(40)
turtle.begin_fill()
turtle.circle(-120,80)
turtle.penup()
turtle.goto(-180,90)
turtle.pendown()
turtle.seth(-130)
turtle.circle(15,110)
turtle.seth(40)
turtle.circle(-106,83)
turtle.seth(30)
turtle.circle(18,105)
turtle.fillcolor(‘white')
turtle.end_fill()

#right eye
turtle.penup()
turtle.goto(20,90)
turtle.pendown()
turtle.seth(40)
turtle.begin_fill()
turtle.circle(-120,80)
turtle.penup()
turtle.goto(20,90)
turtle.pendown()
turtle.seth(-130)
turtle.circle(15,110)
turtle.seth(40)
turtle.circle(-106,83)
turtle.seth(30)
turtle.circle(18,105)
turtle.fillcolor(‘white')
turtle.end_fill()

#Eyeball
turtle.pensize(2)
turtle.penup()
turtle.goto(50,95)
turtle.pendown()
turtle.begin_fill()
turtle.circle(8,360)
turtle.fillcolor(‘black')
turtle.end_fill()
turtle.penup()
turtle.goto(-150,95)
turtle.pendown()
turtle.begin_fill()
turtle.circle(8,360)
turtle.fillcolor(‘black')
turtle.end_fill()

#Blush
turtle.pensize(1)
turtle.pencolor(‘pink')
turtle.begin_fill()
turtle.penup()
turtle.goto(-160,50)
turtle.pendown()
turtle.seth(-90)
for i in range(2):
for j in range(10):
turtle.forward(j)
turtle.left(9)
for j in range(10,0,-1):
turtle.forward(j)
turtle.left(9)
turtle.fillcolor(‘pink')
turtle.end_fill()
turtle.pensize(1)
turtle.pencolor(‘pink')
turtle.begin_fill()
turtle.penup()
turtle.goto(40,50)
turtle.pendown()
turtle.seth(-90)
for i in range(2):
for j in range(10):
turtle.forward(j)
turtle.left(9)
for j in range(10,0,-1):
turtle.forward(j)
turtle.left(9)
turtle.fillcolor(‘pink')
turtle.end_fill()
turtle.hideturtle()

turtle.done()

使用python的turtle绘画滑稽脸实例

以上这篇使用python的turtle绘画滑稽脸实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持三水点靠木。

Python 相关文章推荐
Python生成验证码实例
Aug 21 Python
Python中字典的基本知识初步介绍
May 21 Python
Python 错误和异常代码详解
Jan 29 Python
用Python下载一个网页保存为本地的HTML文件实例
May 21 Python
python 使用 requests 模块发送http请求 的方法
Dec 09 Python
Python中查看变量的类型内存地址所占字节的大小
Jun 26 Python
基于多进程中APScheduler重复运行的解决方法
Jul 22 Python
python3.7 利用函数os pandas利用excel对文件名进行归类
Sep 29 Python
wxPython实现绘图小例子
Nov 19 Python
基于pandas向csv添加新的行和列
May 25 Python
使用SimpleITK读取和保存NIfTI/DICOM文件实例
Jul 01 Python
python实现测试工具(二)——简单的ui测试工具
Oct 19 Python
使用Python的Turtle绘制哆啦A梦实例
Nov 21 #Python
Python 类的魔法属性用法实例分析
Nov 21 #Python
python画蝴蝶曲线图的实例
Nov 21 #Python
Python 静态方法和类方法实例分析
Nov 21 #Python
Python 用turtle实现用正方形画圆的例子
Nov 21 #Python
python 实现兔子生兔子示例
Nov 21 #Python
python3实现用turtle模块画一棵随机樱花树
Nov 21 #Python
You might like
怎样在UNIX系统下安装MySQL
2006/10/09 PHP
php三维数组去重(示例代码)
2013/11/26 PHP
php使用wordwrap格式化文本段落的方法
2015/03/17 PHP
浅析php-fpm静态和动态执行方式的比较
2016/11/09 PHP
php str_replace替换指定次数的方法详解
2017/05/05 PHP
jquerymobile checkbox及时刷新才能获取其准确值
2012/04/14 Javascript
js实现精美的银灰色竖排折叠菜单
2015/05/16 Javascript
基于node实现websocket协议
2016/04/25 Javascript
jQuery EasyUI菜单与按钮详解
2016/07/13 Javascript
JS简单测试循环运行时间的方法
2016/09/04 Javascript
微信小程序 Page()函数详解
2016/10/17 Javascript
jquery.uploadifive插件怎么解决上传限制图片或文件大小问题
2017/05/08 jQuery
基于vue开发微信小程序mpvue-docs跳转页面功能
2019/04/10 Javascript
JS变量提升及函数提升实例解析
2020/09/03 Javascript
利用H5api实现时钟的绘制(javascript)
2020/09/13 Javascript
[01:14:30]TNC vs VG 2019国际邀请赛淘汰赛 胜者组赛BO3 第二场 8.20.mp4
2019/08/22 DOTA
python创建一个最简单http webserver服务器的方法
2015/05/08 Python
浅析Python中将单词首字母大写的capitalize()方法
2015/05/18 Python
Python之读取TXT文件的方法小结
2018/04/27 Python
Python实现的文本对比报告生成工具示例
2018/05/22 Python
python如何实现一个刷网页小程序
2018/11/27 Python
python绘制散点图并标记序号的方法
2018/12/11 Python
python实现趣味图片字符化
2019/04/30 Python
Python对接 xray 和微信实现自动告警
2019/09/17 Python
pycharm安装及如何导入numpy
2020/04/03 Python
python如何从键盘获取输入实例
2020/06/18 Python
Python 基于jwt实现认证机制流程解析
2020/06/22 Python
python实现简单的tcp 文件下载
2020/09/16 Python
pytorch 把图片数据转化成tensor的操作
2021/03/04 Python
美国特价机票专家:Airfarewatchdog
2018/01/24 全球购物
酒店秘书求职信范文
2014/02/17 职场文书
和解协议书
2014/04/16 职场文书
化工工艺设计求职信
2014/06/25 职场文书
小学见习报告
2014/10/31 职场文书
利用Python+OpenCV三步去除水印
2021/05/28 Python
警用民用对讲机找不同
2022/02/18 无线电