使用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进程的信号通讯
Apr 09 Python
Django框架中render_to_response()函数的使用方法
Jul 16 Python
Python 爬虫学习笔记之多线程爬虫
Sep 21 Python
python利用有道翻译实现"语言翻译器"的功能实例
Nov 14 Python
基于Pandas读取csv文件Error的总结
Jun 15 Python
python实现Excel文件转换为TXT文件
Apr 28 Python
如何使用Python实现斐波那契数列
Jul 02 Python
pytorch使用指定GPU训练的实例
Aug 19 Python
pytorch中torch.max和Tensor.view函数用法详解
Jan 03 Python
python 比较字典value的最大值的几种方法
Apr 17 Python
使用keras根据层名称来初始化网络
May 21 Python
Python离线安装openpyxl模块的步骤
Mar 30 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
基于JavaScript如何实现ajax调用后台定义的方法
2015/12/29 Javascript
Javascript之BOM(window对象)详解
2016/05/25 Javascript
Jquery Easyui对话框组件Dialog使用详解(14)
2016/12/19 Javascript
webpack入门必知必会
2017/01/16 Javascript
Bootstrap模态框案例解析
2017/03/05 Javascript
js实现时间轴自动排列效果
2017/03/09 Javascript
SpringMVC+bootstrap table实例详解
2017/06/02 Javascript
Javascript中 toFixed四舍六入方法
2017/08/21 Javascript
Nodejs 复制文件/文件夹的方法
2017/08/24 NodeJs
jquery+css实现下拉列表功能
2017/09/03 jQuery
使用npm安装最新版本nodejs
2018/01/18 NodeJs
element-ui的回调函数Events的用法详解
2018/10/16 Javascript
150行Node.js实现的dns代理工具
2019/08/02 Javascript
js中offset,client , scroll 三大元素知识点总结
2019/09/11 Javascript
微信小程序用户盒子、宫格列表的实现
2020/07/01 Javascript
vue实现简易图片左右旋转,上一张,下一张组件案例
2020/07/31 Javascript
Openlayers实现点闪烁扩散效果
2020/09/24 Javascript
python之Character string(实例讲解)
2017/09/25 Python
Python爬虫实现简单的爬取有道翻译功能示例
2018/07/13 Python
Python实现数值积分方式
2019/11/20 Python
使用 PyTorch 实现 MLP 并在 MNIST 数据集上验证方式
2020/01/08 Python
python numpy数组复制使用实例解析
2020/01/10 Python
解决pytorch-yolov3 train 报错的问题
2020/02/18 Python
获取python运行输出的数据并解析存为dataFrame实例
2020/07/07 Python
Python实现一个简单的递归下降分析器
2020/08/01 Python
Python延迟绑定问题原理及解决方案
2020/08/04 Python
Python JSON常用编解码方法代码实例
2020/09/05 Python
HTML5 progress和meter控件_动力节点Java学院整理
2017/07/06 HTML / CSS
微信端html5页面调用分享接口示例
2018/03/14 HTML / CSS
英国最大的海报商店:GB Posters
2018/03/20 全球购物
Mio Skincare英国官网:身体紧致及孕期身体护理
2018/08/19 全球购物
北美最大的参茸药食商城:德成行
2020/12/06 全球购物
SQL面试题
2013/12/09 面试题
就业自荐信
2013/12/04 职场文书
个人承诺书
2014/03/26 职场文书
书香家庭事迹材料
2014/05/09 职场文书