Python小白 哆唻a梦 用turtle绘图
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 10 22:02:32 2018 @author: 10029
""" import turtle #区域
def my_goto(x, y):
turtle.penup()
turtle.goto(x, y)
turtle.pendown() def eyes():
turtle.tracer(False)
a = 2.5
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a -= 0.05
turtle.lt(3)
turtle.fd(a)
else:
a += 0.05
turtle.lt(3)
turtle.fd(a)
turtle.tracer(True)
# 头
turtle.pensize(3)
turtle.penup()
turtle.circle(150, 40)
turtle.pendown()
turtle.fillcolor('#00a0de')
turtle.begin_fill()
turtle.circle(150, 280)
turtle.end_fill()
#围巾
turtle.fillcolor('#e70010')
turtle.begin_fill()
turtle.seth(0)
turtle.fd(200)
turtle.circle(-5, 90)
turtle.fd(10)
turtle.circle(-5, 90)
turtle.fd(207)
turtle.circle(-5, 90)
turtle.fd(10)
turtle.circle(-5, 90)
turtle.end_fill() # 脸
turtle.fd(183)
turtle.fillcolor('#ffffff')
turtle.begin_fill()
turtle.lt(45)
turtle.circle(120, 100) turtle.seth(90)
eyes() turtle.seth(180)
turtle.penup()
turtle.fd(60)
turtle.pendown()
turtle.seth(90)
eyes() turtle.penup()
turtle.seth(180)
turtle.fd(64)
turtle.pendown()
turtle.seth(215)
turtle.circle(120, 100)
turtle.end_fill() # 鼻子 my_goto(-10, 158)
turtle.fillcolor('#e70010')
turtle.begin_fill()
turtle.circle(20)
turtle.end_fill() # 嘴巴 my_goto(5, 148)
turtle.seth(270)
turtle.fd(100)
turtle.seth(0)
turtle.circle(120, 50)
turtle.seth(230)
turtle.circle(-120, 100) # 胡须 my_goto(-37, 135)
turtle.seth(165)
turtle.fd(60) my_goto(-37, 125)
turtle.seth(180)
turtle.fd(60) my_goto(-37, 115)
turtle.seth(193)
turtle.fd(60) my_goto(37, 135)
turtle.seth(15)
turtle.fd(60) my_goto(37, 125)
turtle.seth(0)
turtle.fd(60) my_goto(37, 115)
turtle.seth(-13)
turtle.fd(60) my_goto(0, 0)
turtle.seth(0)
turtle.penup()
turtle.circle(150, 50)
turtle.pendown()
turtle.seth(30)
turtle.fd(40)
turtle.seth(70)
turtle.circle(-30, 270) turtle.fillcolor('#00a0de')
turtle.begin_fill() turtle.seth(230)
turtle.fd(80)
turtle.seth(90)
turtle.circle(1000, 1)
turtle.seth(-89)
turtle.circle(-1000, 10) turtle.seth(180)
turtle.fd(70)
turtle.seth(90)
turtle.circle(30, 180)
turtle.seth(180)
turtle.fd(70) turtle.seth(100)
turtle.circle(-1000, 9) turtle.seth(-86)
turtle.circle(1000, 2)
turtle.seth(230)
turtle.fd(40) turtle.circle(-30, 230)
turtle.seth(45)
turtle.fd(81)
turtle.seth(0)
turtle.fd(203)
turtle.circle(5, 90)
turtle.fd(10)
turtle.circle(5, 90)
turtle.fd(7)
turtle.seth(40)
turtle.circle(150, 10)
turtle.seth(30)
turtle.fd(40)
turtle.end_fill() # 左手
turtle.seth(70)
turtle.fillcolor('#ffffff')
turtle.begin_fill()
turtle.circle(-30)
turtle.end_fill() # 右手
my_goto(-133.97, -91.81)
turtle.seth(50)
turtle.fillcolor('#ffffff')
turtle.begin_fill()
turtle.circle(30)
turtle.end_fill() # 脚
my_goto(103.74, -182.59)
turtle.seth(0)
turtle.fillcolor('#ffffff')
turtle.begin_fill()
turtle.fd(15)
turtle.circle(-15, 180)
turtle.fd(90)
turtle.circle(-15, 180)
turtle.fd(10)
turtle.end_fill() my_goto(-96.26, -182.59)
turtle.seth(180)
turtle.fillcolor('#ffffff')
turtle.begin_fill()
turtle.fd(15)
turtle.circle(15, 180)
turtle.fd(90)
turtle.circle(15, 180)
turtle.fd(10)
turtle.end_fill() # 口袋
my_goto(-103.42, 15.09)
turtle.seth(0)
turtle.fd(38)
turtle.seth(230)
turtle.begin_fill()
turtle.circle(90, 260)
turtle.end_fill() my_goto(5, -40)
turtle.seth(0)
turtle.fd(70)
turtle.seth(-90)
turtle.circle(-70, 180)
turtle.seth(0)
turtle.fd(70) #铃铛
my_goto(-103.42, 15.09)
turtle.fd(90)
turtle.seth(70)
turtle.fillcolor('#ffd200')
turtle.begin_fill()
turtle.circle(-20)
turtle.end_fill()
turtle.seth(170)
turtle.fillcolor('#ffd200')
turtle.begin_fill()
turtle.circle(-2, 180)
turtle.seth(10)
turtle.circle(-100, 22)
turtle.circle(-2, 180)
turtle.seth(180-10)
turtle.circle(100, 22)
turtle.end_fill()
turtle.goto(-13.42, 15.09)
turtle.seth(250)
turtle.circle(20, 110)
turtle.seth(90)
turtle.fd(15)
turtle.dot(10)
my_goto(0, -150) # 眼睛
turtle.seth(0)
my_goto(-20, 195)
turtle.fillcolor('#000000')
turtle.begin_fill()
turtle.circle(13)
turtle.end_fill() turtle.pensize(6)
my_goto(20, 205)
turtle.seth(75)
turtle.circle(-10, 150)
turtle.pensize(3) my_goto(-17, 200)
turtle.seth(0)
turtle.fillcolor('#ffffff')
turtle.begin_fill()
turtle.circle(5)
turtle.end_fill()
my_goto(0, 0) turtle.exitonclick()
Python小白 哆唻a梦 用turtle绘图的更多相关文章
- Python小白绘图 哆唻A梦 turtle真的很强大!
# -*- coding: utf-8 -*- """ Created on Sat Nov 10 22:02:32 2018 @author: 10029 " ...
- 10分钟轻松学会python turtle绘图
 1. 画布(canvas) 1.1 相关函数: 2. 画笔 2.1 画笔的状态 2.2 画笔的属性 2.3 绘图命令 3. 命令详解 4. 绘图举例 4.1 太阳花 4.2 绘制小蟒蛇 4.3 绘 ...
- 10分钟轻松学会 Python turtle 绘图
python2.6版本中后引入的一个简单的绘图工具,叫做海龟绘图(Turtle Graphics),turtle库是python的内部库,使用导入即可 import turtle 先说明一下turtl ...
- python:turtle绘图模块
turtle模块 海龟绘图(Turtle Graphics),python内置模块,非常简单好玩的一个库. 一.导入库 import turtle from turtle import * 二.画布的 ...
- python小白的初步爬虫
前序: 最近工作不是很忙,领导突然找我谈话,说是谈话,其实就是分配活呗.果不其然,很快进入正题, 给了我一个网址链接,然后说需要商品的信息...巴拉巴拉.好吧,去做吧. 我当时的内心是崩溃的,pyt ...
- python课程设计笔记(三)turtle绘图库(海龟库)
实例:绘制一条蟒蛇 #turtle:绘图库(海龟库) import turtle turtle.setup(650,350,200,200) turtle.penup() turtle.fd(-250 ...
- Python小白需要知道的 20 个骚操作!
Python小白需要知道的 20 个骚操作! Python 是一个解释型语言,可读性与易用性让它越来越热门.正如 Python 之禅中所述: 优美胜于丑陋,明了胜于晦涩. 在你的日常编码中,以下技巧可 ...
- Django入门到进阶-更适合Python小白的系统课程
Django入门到进阶-更适合Python小白的系统课程 整个课程都看完了,这个课程的分享可以往下看,下面有链接,之前做java开发也做了一些年头,也分享下自己看这个视频的感受,单论单个知识点课程本身 ...
- Python小白
.IDLE软件为内建于CPython的集成开发环境(IDE),包括编辑器,编译或解释器,调试器 .py(后缀保存) 2.行一,单行注释 多行,””” ‘’’ 之后,内建 ...
随机推荐
- Robin Hood CodeForces - 672D (二分)
大意: 给定数组$a$, 每次操作使最大元素减小1最小元素增大1, 求k次操作后最大值与最小值的差. 二分出k次操作后最大值的最小值以及最小值的最大值, 若和能平分答案即为$max(0,R-L)$, ...
- C#数组--(Array类的属性和方法)
Array 类是 C# 中所有数组的基类,它是在 System 命名空间中定义.Array 类提供了各种用于数组的属性和方法,可看作扩充了功能的数组(但不等同数组),可以使用Array类的属性来对数组 ...
- java 使用GET请求编码问题解决
java GET请求解决编码的有效代码前端: encodeURI(encodeURI("你好") 后端代码: String name = request.getParameter( ...
- 你所误解的微信公众号开发、以及微信公众号网页授权、接收url跳转参数等问题
前言:有一星期没跟新博客了,最近太忙.项目赶进度就没把时间花在博客上:今天来说说所谓的微信公众号开发和填坑记录: 微信公众号:运行在微信终端的应用 (对于开发者来说比较爽的你只需考虑兼容微信浏览器,因 ...
- maven打jar包 没有主属性清单
使用mvn clean package命令打包,java -jar 命令运行时,提示:“jar 包没有主属性清单”.修改pom文件后解决: <build> <plugins> ...
- Sed练习
sed:编辑器 sed:Stream EDitor,行编辑器 用法: sed [opthon]... ‘script’ inputfile.. scritp:‘地址命令’ 常用选项: ...
- es6,es7,es8
概述 ES全称ECMAScript,ECMAScript是ECMA制定的标准化脚本语言.目前JavaScript使用的ECMAScript版本为ECMAScript-262. ECMAScript 标 ...
- 【C语言】数组知识点总结
[C语言]数组知识点总结 标签: 数组 2018年04月12日 17:44:4481人阅读 评论(0) 收藏 举报 分类: C语言知识总结(4) 版权声明:本文为博主原创文章,未经博主允许不得转载 ...
- IntelliJ IDEA 安装和破解教程
1.首先下载IntelliJ IDEA,下载链接:http://www.jetbrains.com/idea/download/#section=windows:记得一定要选择UItimate版! 2 ...
- day47-python爬虫学习二
2.Request的会话对象 s = requests.session() Python2 S = requests.Session() 所有一次会话的信息都保存在s中,只需要对s进行操作就可以了. ...