# -*- 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真的很强大!的更多相关文章

  1. Python小白 哆唻a梦 用turtle绘图

    点击观看视频 # -*- coding: utf-8 -*- """ Created on Sat Nov 10 22:02:32 2018 @author: 10029 ...

  2. Python之绘图和可视化

    Python之绘图和可视化 1. 启用matplotlib 最常用的Pylab模式的IPython(IPython --pylab) 2. matplotlib的图像都位于Figure对象中. 可以使 ...

  3. Python小白的数学建模课-09 微分方程模型

    小白往往听到微分方程就觉得害怕,其实数学建模中的微分方程模型不仅没那么复杂,而且很容易写出高水平的数模论文. 本文介绍微分方程模型的建模与求解,通过常微分方程.常微分方程组.高阶常微分方程 3个案例手 ...

  4. Python小白的数学建模课-B5. 新冠疫情 SEIR模型

    传染病的数学模型是数学建模中的典型问题,常见的传染病模型有 SI.SIR.SIRS.SEIR 模型. 考虑存在易感者.暴露者.患病者和康复者四类人群,适用于具有潜伏期.治愈后获得终身免疫的传染病. 本 ...

  5. Python小白的数学建模课-B6. 新冠疫情 SEIR 改进模型

    传染病的数学模型是数学建模中的典型问题,常见的传染病模型有 SI.SIR.SIRS.SEIR 模型. SEIR 模型考虑存在易感者.暴露者.患病者和康复者四类人群,适用于具有潜伏期.治愈后获得终身免疫 ...

  6. Python小白的数学建模课-B4. 新冠疫情 SIR模型

    Python小白的数学建模课-B4. 新冠疫情 SIR模型 传染病的数学模型是数学建模中的典型问题,常见的传染病模型有 SI.SIR.SIRS.SEIR 模型. SIR 模型将人群分为易感者(S类). ...

  7. Python小白的数学建模课-16.最短路径算法

    最短路径问题是图论研究中的经典算法问题,用于计算图中一个顶点到另一个顶点的最短路径. 在图论中,最短路径长度与最短路径距离却是不同的概念和问题,经常会被混淆. 求最短路径长度的常用算法是 Dijkst ...

  8. Python小白的数学建模课-15.图论基本概念

    图论中所说的图,不是图形图像或地图,而是指由顶点和边所构成的图形结构. 图论不仅与拓扑学.计算机数据结构和算法密切相关,而且正在成为机器学习的关键技术. 本系列结合数学建模的应用需求,来介绍 Netw ...

  9. Python小白的数学建模课-19.网络流优化问题

    流在生活中十分常见,例如交通系统中的人流.车流.物流,供水管网中的水流,金融系统中的现金流,网络中的信息流.网络流优化问题是基本的网络优化问题,应用非常广泛. 网络流优化问题最重要的指标是边的成本和容 ...

随机推荐

  1. C++ 中缀转后缀表达式并求值

    //中缀转后缀 #include<iostream> #include<stack> using namespace std; int prio(char x){ ; ; ; ...

  2. 从零开始学习Java多线程(三)

    本文主要对Java多线程同步与通信以及相关锁的介绍. 1 .Java多线程安全问题 Java多线程安全问题是实现并发最大的问题,可以说多线程开发其实就是围绕多线程安全问题开发,涉及之深,不是简简单单一 ...

  3. C语言博客作业04——数组

    1.本章学习总结 1.1思维导图 1.2本章学习体会及代码量 1.2.1学习体会 这几周学习了数组,数组分为三大块:一维数组.二维数组和字符数组.数组相对于之前普通变量的好处就是可以储存数值,方便数据 ...

  4. 爬虫(五)requests模块2

    引入 有些时候,我们在使用爬虫程序去爬取一些用户相关信息的数据(爬取张三“人人网”个人主页数据)时,如果使用之前requests模块常规操作时,往往达不到我们想要的目的,例如: #!/usr/bin/ ...

  5. GD库imagettftext中文乱码的问题

    linux下出现乱码,加上编码转换就可以了. $str = mb_convert_encoding($str, "html-entities", "utf-8" ...

  6. redis最全配置讲解

    #redis.conf# Redis configuration file example.# ./redis-server /path/to/redis.conf ################# ...

  7. PDF 补丁丁 0.6.0.3288 版发布(修复“合并文件”功能的文件夹文件排序问题)

    新的测试版修复了合并文件功能中添加名称带有“.”点号的文件夹时无法正常排序文件的问题. 使用合并文件功能的用户建议更新.

  8. Angular2 使用CLI创建新项目

    1.安装node.js: 2. npm install -g @angular/cli 3.ng new projectName 4.ng serve PS:如果要使用moduleId,需先在src目 ...

  9. css 三角

    http://peunzhang.github.io/demo/css_angle/index.html

  10. python修炼第二天

    第二天的课程还是塞得满满的,一天下来充实也疲惫.那天听出金星师傅嗓子有些沙哑,想必是讲课说话太多导致.啥也不说了.唯有努力练功方可回报! 1 序: 今天主要是详细学习了绝大部分的数据类型,字符编码,边 ...