使用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学习资料
Feb 08 Python
Win7上搭建Cocos2d-x 3.1.1开发环境
Jul 03 Python
python中使用urllib2获取http请求状态码的代码例子
Jul 07 Python
python+opencv实现的简单人脸识别代码示例
Nov 14 Python
Python XlsxWriter模块Chart类用法实例分析
Mar 11 Python
详解python 3.6 安装json 模块(simplejson)
Apr 02 Python
Python多版本开发环境管理工具介绍
Jul 03 Python
Python解析json时提示“string indices must be integers”问题解决方法
Jul 31 Python
python的等深分箱实例
Nov 22 Python
python如何通过闭包实现计算器的功能
Feb 22 Python
解决django 向mysql中写入中文字符出错的问题
May 18 Python
详解分布式系统中如何用python实现Paxos
May 18 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判断是否为json格式的方法
2014/03/04 PHP
php使用反射插入对象示例分享
2014/03/11 PHP
PHP定时任务延缓执行的实现
2014/10/08 PHP
thinkPHP框架中layer.js的封装与使用方法示例
2019/01/18 PHP
PHP实现获取ip地址的5种方法,以及插入用户登录日志操作示例
2019/02/28 PHP
JS在可编辑的div中的光标位置插入内容的方法
2014/11/20 Javascript
jQuery学习笔记之创建DOM元素
2015/01/19 Javascript
JQuery中DOM事件合成用法实例分析
2015/06/13 Javascript
javascript 应用小技巧方法汇总
2015/07/05 Javascript
果断收藏9个Javascript代码高亮脚本
2016/01/06 Javascript
JS中from 表单序列化提交的代码
2017/01/20 Javascript
微信小程序中使用自定义图标(阿里icon)的方法
2018/08/20 Javascript
vue框架中props的typescript用法详解
2020/02/17 Javascript
js编写简易的计算器
2020/07/29 Javascript
Vue中使用Echarts仪表盘展示实时数据的实现
2020/11/01 Javascript
Node.js中的异步生成器与异步迭代详解
2021/01/31 Javascript
[52:44]VGJ.T vs infamous Supermajor小组赛D组败者组第一轮 BO3 第一场 6.3
2018/06/04 DOTA
python networkx 根据图的权重画图实现
2019/07/10 Python
Python模拟登录之滑块验证码的破解(实例代码)
2019/11/18 Python
pytorch 获取tensor维度信息示例
2020/01/03 Python
解决Pymongo insert时会自动添加_id的问题
2020/12/05 Python
python中HTMLParser模块知识点总结
2021/01/25 Python
python反扒机制的5种解决方法
2021/02/06 Python
Python如何使用神经网络进行简单文本分类
2021/02/25 Python
彪马法国官网:PUMA法国
2019/12/15 全球购物
C#实现对任一张表的数据进行增,删,改,查要求,运用Webservice,体现出三层架构
2014/07/11 面试题
车间调度岗位职责
2013/11/30 职场文书
幼儿教育感言
2014/02/05 职场文书
单位工作证明范文
2014/09/14 职场文书
教师节标语大全
2014/10/07 职场文书
领导干部整治奢华浪费之风思想汇报
2014/10/07 职场文书
煤矿安全保证书
2015/02/27 职场文书
婚育证明样本
2015/06/16 职场文书
导游词之无锡东林书院
2019/12/11 职场文书
Ruby使用Mysql2连接操作MySQL
2022/04/19 Ruby
使用compose函数优化代码提高可读性及扩展性
2022/06/16 Javascript