使用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实现360皮肤按钮控件示例
Feb 21 Python
python打开网页和暂停实例
Sep 30 Python
浅谈python中scipy.misc.logsumexp函数的运用场景
Jun 23 Python
python 基础教程之Map使用方法
Jan 17 Python
Python2 Selenium元素定位的实现(8种)
Feb 25 Python
Python使用sqlalchemy模块连接数据库操作示例
Mar 13 Python
python [:3] 实现提取数组中的数
Nov 27 Python
python脚本后台执行方式
Dec 21 Python
python GUI框架pyqt5 对图片进行流式布局的方法(瀑布流flowlayout)
Mar 12 Python
快速创建python 虚拟环境
Nov 28 Python
python字符串常规操作大全
May 02 Python
Python可变与不可变数据和深拷贝与浅拷贝
Apr 06 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
实用函数4
2007/11/08 PHP
PHP 获取文件路径(灵活应用__FILE__)
2013/02/15 PHP
解析PHP高效率写法(详解原因)
2013/06/20 PHP
CI操作cookie的方法分析(基于helper类库)
2016/03/28 PHP
PHP+MySQL存储数据常见中文乱码问题小结
2016/06/13 PHP
thinkphp查询,3.X 5.0方法(亲试可行)
2017/06/17 PHP
Thinkphp5.0 框架实现控制器向视图view赋值及视图view取值操作示例
2019/10/12 PHP
关于__defineGetter__ 和__defineSetter__的说明
2007/05/12 Javascript
Prototype中dom对象方法汇总
2008/09/17 Javascript
8个超棒的学习 jQuery 的网站 推荐收藏
2011/04/02 Javascript
php对mongodb的扩展(小试牛刀)
2012/11/11 Javascript
JS实现淡蓝色简洁竖向Tab点击切换效果
2015/10/06 Javascript
JavaScript中数组slice和splice的对比小结
2016/09/22 Javascript
jQuery简单实现MD5加密的方法
2017/03/03 Javascript
JavaScript获取URL参数的方法之一
2017/03/24 Javascript
jQuery插件FusionCharts绘制2D柱状图和折线图的组合图效果示例【附demo源码】
2017/04/10 jQuery
微信小程序之电影影评小程序制作代码
2017/08/03 Javascript
vue项目中使用vue-i18n报错的解决方法
2019/01/13 Javascript
Vue 实现前端权限控制的示例代码
2019/07/09 Javascript
Layui实现数据表格中鼠标悬浮图片放大效果,离开时恢复原图的方法
2019/09/11 Javascript
利用python获取某年中每个月的第一天和最后一天
2016/12/15 Python
Django对models里的objects的使用详解
2019/08/17 Python
python-序列解包(对可迭代元素的快速取值方法)
2019/08/24 Python
python下载卫星云图合成gif的方法示例
2020/02/18 Python
python图片验证码识别最新模块muggle_ocr的示例代码
2020/07/03 Python
利用keras使用神经网络预测销量操作
2020/07/07 Python
英国领先的名牌服装折扣零售商:Brown Bag Clothing
2019/01/08 全球购物
软件测试有哪些?什么是配置项?
2012/02/12 面试题
保险专业大专生求职信
2013/10/26 职场文书
英语专业应届生求职信范文
2013/11/15 职场文书
春秋淹城导游词
2015/02/11 职场文书
毕业班工作总结
2015/08/10 职场文书
加薪申请书应该这样写!
2019/07/04 职场文书
创业计划书之蛋糕店
2019/08/29 职场文书
导游词之唐山景点
2019/12/18 职场文书
Redis官方可视化工具RedisInsight安装使用教程
2022/04/19 Redis