使用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中字典和JSON互转操作实例
Jan 19 Python
python实现从一组颜色中找出与给定颜色最接近颜色的方法
Mar 19 Python
Hadoop中的Python框架的使用指南
Apr 22 Python
基于python实现微信模板消息
Dec 21 Python
python使用super()出现错误解决办法
Aug 14 Python
将字典转换为DataFrame并进行频次统计的方法
Apr 08 Python
python3使用smtplib实现发送邮件功能
May 22 Python
python中字符串的操作方法大全
Jun 03 Python
解决python写入mysql中datetime类型遇到的问题
Jun 21 Python
python实现录音小程序
Oct 26 Python
Python中的延迟绑定原理详解
Oct 11 Python
Python安装tar.gz格式文件方法详解
Jan 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
解析PHP提交后跳转
2013/06/23 PHP
深入剖析浏览器退出之后php还会继续执行么
2016/05/17 PHP
JavaScript中Null与Undefined的区别解析
2015/06/30 Javascript
JS动态添加选项案例分析
2016/10/17 Javascript
AngularJS入门教程之多视图切换用法示例
2016/11/02 Javascript
用director.js实现前端路由使用实例
2017/01/27 Javascript
微信小程序 弹幕功能简单实例
2017/02/14 Javascript
基于JavaScript实现弹幕特效
2020/08/27 Javascript
mui框架 页面无法滚动的解决方法(推荐)
2018/01/25 Javascript
vue单个组件实现无限层级多选菜单功能
2018/04/10 Javascript
angularjs1.5 组件内用函数向外传值的实例
2018/09/30 Javascript
利用Vue实现一个markdown编辑器实例代码
2019/05/19 Javascript
vue-mugen-scroll组件实现pc端滚动刷新
2019/08/16 Javascript
在vant中使用时间选择器和popup弹出层的操作
2020/11/04 Javascript
[56:47]Ti4 循环赛第三日 iG vs Liquid
2014/07/12 DOTA
[42:20]Secret vs Liquid 2019国际邀请赛小组赛 BO2 第二场 8.15
2019/08/17 DOTA
[02:03]完美世界DOTA2联赛10月30日赛事集锦
2020/10/31 DOTA
python访问纯真IP数据库的代码
2011/05/19 Python
Python编程中对文件和存储器的读写示例
2016/01/25 Python
python实现拼图小游戏
2020/02/22 Python
python获取天气接口给指定微信好友发天气预报
2020/12/28 Python
美国顶级户外凉鞋品牌:Chacos
2017/03/27 全球购物
美国女孩洋娃娃店:American Girl
2017/10/24 全球购物
C语言笔试集
2012/07/24 面试题
大学生的网络创业计划书
2013/12/26 职场文书
商场经理竞聘演讲稿
2014/01/01 职场文书
绩效工资分配方案
2014/01/18 职场文书
大学生期末自我鉴定
2014/02/01 职场文书
2013年最新自荐信范文
2014/06/23 职场文书
运动会报道稿300字
2014/10/02 职场文书
代办社保委托书范文
2014/10/06 职场文书
2015年企业新年寄语
2014/12/08 职场文书
浅析Python中的套接字编程
2021/06/22 Python
详解MySQL多版本并发控制机制(MVCC)源码
2021/06/23 MySQL
Python Pygame实战在打砖块游戏的实现
2022/03/17 Python
Mysql表数据比较大情况下修改添加字段的方法实例
2022/06/28 MySQL