目录

1 哆啦A梦

2 小猪佩奇

3 Python代码实现(哆啦A梦)

4 Python代码实现(小猪佩奇 )


1 哆啦A梦

“只要把愿望系在竹竿上请求月亮女神,心愿便能达成”。我超喜欢这句话。

哆啦A梦的创造要追溯到1969年的某个截稿日,作者藤子·F·不二雄的家里突然闯进了一只小猫,虽然很快就要截稿了,但作者还是和小猫玩了起来,还替小猫挠虱子,而这一挠就是几个小时。等作者发现时间不够用的时候,已经来不及完成稿子。这时作者像热锅上的蚂蚁走来走去,突然踢到了女儿的不倒翁玩具,于是作者灵光一现,把猫的形象和不倒翁结合起来,就创造了哆啦A梦。


2 小猪佩奇

对比于国内的《喜羊羊与灰太狼》和《熊出没》,我希望有一天喜羊羊被灰太狼炖了、熊大被光头强一枪打中,然后直接卖到动物园。(哈哈哈......)可是这个想法一直没实现,有些失落。还是看小猪佩奇吧:

由英国E1 Kids于2004年5月31日发行首播后,其动画片已于全球180个地区播放,现已播出6季;

中国中央电视台少儿频道也在热播之中,极简的动画风格,幽默的对话语调,深具教育意义的故事情节,不仅能让学龄前儿童学习知识,更能让小朋友们从小养成良好的生活习惯体验生活,深受全球各地小朋友们以及其家长们的喜爱。


Python代码实现(哆啦A梦)

import turtle as t
t.title('哆啦A梦')
# t.speed(5)
t.pensize(8)
t.hideturtle()
t.screensize(500, 500, bg='white')"""猫脸"""
t.fillcolor('#00A1E8')
t.begin_fill()
t.circle(120)
t.end_fill()
t.pensize(3)
t.fillcolor('white')
t.begin_fill()
t.circle(100)
t.end_fill()
t.pu()
t.home()
t.goto(0, 134)
t.pd()
t.pensize(4)
t.fillcolor("#EA0014")
t.begin_fill()
t.circle(18)
t.end_fill()
t.pu()
t.goto(7, 155)
t.pensize(2)
t.color('white', 'white')
t.pd()
t.begin_fill()
t.circle(4)
t.end_fill()
t.pu()
t.goto(-30, 160)
t.pensize(4)
t.pd()
t.color('black', 'white')
t.begin_fill()
a = 0.4
for i in range(120):if 0 <= i < 30 or 60 <= i < 90:a = a + 0.08t.lt(3)  # 向左转3度t.fd(a)  # 向前走a的步长else:a = a - 0.08t.lt(3)t.fd(a)
t.end_fill()
t.pu()
t.goto(30, 160)
t.pensize(4)
t.pd()
t.color('black', 'white')
t.begin_fill()
for i in range(120):if 0 <= i < 30 or 60 <= i < 90:a = a + 0.08t.lt(3)  # 向左转3度t.fd(a)  # 向前走a的步长else:a = a - 0.08t.lt(3)t.fd(a)
t.end_fill()
t.pu()
t.goto(-38, 190)
t.pensize(8)
t.pd()
t.right(-30)
t.forward(15)
t.right(70)
t.forward(15)
t.pu()
t.goto(15, 185)
t.pensize(4)
t.pd()
t.color('black', 'black')
t.begin_fill()
t.circle(13)
t.end_fill()
t.pu()
t.goto(13, 190)
t.pensize(2)
t.pd()
t.color('white', 'white')
t.begin_fill()
t.circle(5)
t.end_fill()
t.pu()
t.home()
t.goto(0, 134)
t.pensize(4)
t.pencolor('black')
t.pd()
t.right(90)
t.forward(40)
t.pu()
t.home()
t.goto(0, 124)
t.pensize(3)
t.pencolor('black')
t.pd()
t.left(10)
t.forward(80)
t.pu()
t.home()
t.goto(0, 114)
t.pensize(3)
t.pencolor('black')
t.pd()
t.left(6)
t.forward(80)
t.pu()
t.home()
t.goto(0, 104)
t.pensize(3)
t.pencolor('black')
t.pd()
t.left(0)
t.forward(80)
"""左边的胡子"""
t.pu()
t.home()
t.goto(0, 124)
t.pensize(3)
t.pencolor('black')
t.pd()
t.left(170)
t.forward(80)
t.pu()
t.home()
t.goto(0, 114)
t.pensize(3)
t.pencolor('black')
t.pd()
t.left(174)
t.forward(80)
t.pu()
t.home()
t.goto(0, 104)
t.pensize(3)
t.pencolor('black')
t.pd()
t.left(180)
t.forward(80)
t.pu()
t.goto(-70, 70)
t.pd()
t.color('black', 'red')
t.pensize(6)
t.seth(-60)
t.begin_fill()
t.circle(80, 40)
t.circle(80, 80)
t.end_fill()
t.pu()
t.home()
t.goto(-80, 70)
t.pd()
t.forward(160)
t.pu()
t.home()
t.goto(-50, 50)
t.pd()
t.pensize(1)
t.fillcolor("#eb6e1a")
t.seth(40)
t.begin_fill()
t.circle(-40, 40)
t.circle(-40, 40)
t.seth(40)
t.circle(-40, 40)
t.circle(-40, 40)
t.seth(220)
t.circle(-80, 40)
t.circle(-80, 40)
t.end_fill()
# 领带
t.pu()
t.goto(-70, 12)
t.pensize(14)
t.pencolor('red')
t.pd()
t.seth(-20)
t.circle(200, 30)
t.circle(200, 10)
"""铃铛"""
t.pu()
t.goto(0, -46)
t.pd()
t.pensize(3)
t.color("black", '#f8d102')
t.begin_fill()
t.circle(25)
t.end_fill()
t.pu()
t.goto(-5, -40)
t.pd()
t.pensize(2)
t.color("black", '#79675d')
t.begin_fill()
t.circle(5)
t.end_fill()
t.pensize(3)
t.right(115)
t.forward(7)
t.mainloop()

4 Python代码实现(小猪佩奇 )


import turtle
from turtle import *
turtle.title('小猪佩奇')def nose(x,y):"""画鼻子"""pensize(5)pencolor((255, 155, 192))penup()# 将海龟移动到指定的坐标goto(x,y)pendown()# 设置海龟的方向(0-东、90-北、180-西、270-南)setheading(-30)begin_fill()fillcolor(255, 192, 203)a = 0.4for i in range(120):if 0 <= i < 30 or 60 <= i <90:a = a + 0.08# 向左转3度left(3)# 向前走forward(a)else:a = a - 0.08left(3)forward(a)end_fill()penup()setheading(90)forward(25)setheading(0)forward(10)pendown()"""设置画笔的颜色(红, 绿, 蓝)"""pencolor(255, 155, 192)setheading(10)begin_fill()circle(5)color(160, 82, 45)end_fill()penup()setheading(0)forward(20)pendown()pencolor(255, 155, 192)setheading(10)begin_fill()circle(5)color(160, 82, 45)end_fill()def head(x, y):"""画头"""color((255, 155, 192), "pink")penup()goto(x,y)setheading(0)pendown()begin_fill()setheading(180)circle(300, -30)circle(100, -60)circle(80, -100)circle(150, -20)circle(60, -95)setheading(161)circle(-300, 15)penup()goto(-100, 100)pendown()setheading(-30)a = 0.4for i in range(60):if 0<= i < 30 or 60 <= i < 90:a = a + 0.08lt(3) #向左转3度fd(a) #向前走a的步长else:a = a - 0.08lt(3)fd(a)end_fill()def ears(x,y):"""画耳朵"""color((255, 155, 192), "pink")penup()goto(x, y)pendown()begin_fill()setheading(100)circle(-50, 50)circle(-10, 120)circle(-50, 54)end_fill()penup()setheading(90)forward(-12)setheading(0)forward(30)pendown()begin_fill()setheading(90)circle(-50, 50)circle(-10, 120)circle(-50, 56)end_fill()def eyes(x,y):"""画眼睛"""color((255, 155, 192), "white")penup()setheading(90)forward(-20)setheading(0)forward(-95)pendown()begin_fill()circle(15)end_fill()color("black")penup()setheading(90)forward(12)setheading(0)forward(-3)pendown()begin_fill()circle(3)end_fill()color((255, 155, 192), "white")penup()seth(90)forward(-25)seth(0)forward(40)pendown()begin_fill()circle(15)end_fill()color("black")penup()setheading(90)forward(12)setheading(0)forward(-3)pendown()begin_fill()circle(3)end_fill()def cheek(x,y):"""画脸颊"""color((255, 155, 192))penup()goto(x,y)pendown()setheading(0)begin_fill()circle(30)end_fill()def mouth(x,y):"""画嘴巴"""color(239, 69, 19)penup()goto(x, y)pendown()setheading(-80)circle(30, 40)circle(40, 80)def body(x,y):'''画身体'''penup()goto(x,y)pencolor('red')fillcolor(250,106,106)pendown()begin_fill()setheading(-66)circle(-450,17)setheading(180)forward(185)setheading(85)circle(-450,17)end_fill()'''右手'''penup()goto(110,-45)pendown()pensize(8)pencolor(255, 192, 203)setheading(30)circle(-400,10)penup()goto(167,-5)pendown()setheading(-120)forward(20)left(100)forward(20)'''左手'''penup()goto(-25,-45)pendown()pencolor(255, 192, 203)setheading(150)circle(400,10)penup()goto(-78,-6)pendown()setheading(-60)forward(20)right(100)forward(20)def feet1(x,y):pensize(7)pencolor(255, 192, 203)penup()goto(x,y)setheading(-90)pendown()forward(10)penup()goto(x-12,y-10)pendown()pencolor(238,201,0)fillcolor(238,230,132)begin_fill()setheading(0)forward(24)right(90)forward(36)right(90)forward(40)circle(-10,180)forward(16)left(90)forward(12)end_fill()def feet2(x,y):pensize(7)pencolor(255, 192, 203)penup()goto(x,y)setheading(-90)pendown()forward(10)penup()goto(x-12,y-10)pendown()pencolor(238,201,0)fillcolor(238,230,132)begin_fill()setheading(0)forward(24)right(90)forward(36)right(90)forward(40)circle(-10,180)forward(16)left(90)forward(12)end_fill()def tail(x,y):pensize(8)penup()goto(x,y)pendown()pencolor(255, 192, 203)setheading(-5)circle(30,100)circle(10,180)circle(20,150)def backg(x):penup()goto(-420,x)setheading(0)fillcolor(50,205,50)begin_fill()forward(840)right(90)forward(300)right(90)forward(840)right(90)forward(300)end_fill()setheading(0)fillcolor(0,191,255)begin_fill()forward(840)left(90)forward(600)left(90)forward(840)left(90)forward(600)end_fill()def cloude1(x, y):"""画云"""penup()goto(x,y)setheading(90)fillcolor(255,255,255)begin_fill()a = 0.4for i in range(120):if 0 <= i < 30 or 60 <= i <90:a = a + 0.14# 向左转3度left(3)# 向前走forward(a)else:a = a - 0.15left(3)forward(a)end_fill()def cloude2(x, y):"""画云"""penup()goto(x,y)setheading(90)fillcolor(255,255,255)begin_fill()a = 0.4for i in range(120):if 0 <= i < 30 or 60 <= i <90:a = a + 0.15# 向左转3度left(3)# 向前走forward(a)else:a = a - 0.13left(3)forward(a)end_fill()def setting():"""设置参数"""pensize(5)# 隐藏海龟hideturtle()colormode(255)color((255, 155, 192), "pink")setup(840, 700)speed(10)def main():"""主函数"""setting() backg(0)body(105,-20)nose(-100, 100)head(-69, 167)ears(0, 160)eyes(0, 140)cheek(80, 10)mouth(-20, 30)feet1(10,-150)feet2(90,-150)tail(130,-110)cloude1(-200,200)cloude2(300,300)done()if __name__ == '__main__':main()

哆啦A梦和小猪佩奇(Python实现)相关推荐

  1. python海龟绘图(turtle)手绘【玫瑰、时钟、哆啦A梦、小猪佩奇、史迪仔】

    前言 python的第三方库绘图模块turtle(因其本意有海龟.乌龟的意思,又称为海龟绘图),可以用来绘制一些很好玩的东西.之前就有盛极一时的海龟绘图绘制冰墩墩,这里给大家总结了关于海龟绘图的一些方 ...

  2. 《Turtle绘图》Python用Turtle库绘制多啦爱梦、小猪佩奇、皮卡丘等卡通人物

    声明 本文仅在CSDN发布,未经允许请勿转载或引用! 本文链接:https://blog.csdn.net/meenr/article/details/107245170 目录 利用Turtle库绘制 ...

  3. 用python画小猪佩奇的编码_如何用python绘制小猪佩奇-python绘图教程图文讲解

    原标题:如何用python绘制小猪佩奇-python绘图教程图文讲解 如何运用python来绘制小猪佩奇呢?通过几道简单的python代码即可让你绘制出小猪佩奇,话不多说,直接上代码. 用python ...

  4. 用python画哆啦a梦的身体_每天一个Python小技巧,用Python 画个多啦A梦,小猪佩奇,文末还有Python入门学习视频...

    见网络上有人用Python 画出来个多啦A梦,很是新奇,来来来,我们看一下他们主要用到的库. 其实主要用的库就一个 turtle 库 先说明一下turtle绘图的基础知识: 1. 画布(canvas) ...

  5. 用python画字母b_用Python 画个多啦A梦,小猪佩奇

    见网络上有人用Python 画出来个多啦A梦,很是新奇,来来来,我们看一下他们主要用到的库. 其实主要用的库就一个 turtle 库 先说明一下turtle绘图的基础知识: 1. 画布(canvas) ...

  6. python turtle绕原点旋转_每天一个Python小技巧,用Python 画个多啦A梦,小猪佩奇,文末还有Python入门学习视频

    见网络上有人用Python 画出来个多啦A梦,很是新奇,来来来,我们看一下他们主要用到的库. 其实主要用的库就一个 turtle 库 先说明一下turtle绘图的基础知识: 1. 画布(canvas) ...

  7. python绘制小猪佩奇程序设计大作业_代码绘制一只小猪佩奇---python篇

    今天教大家用python的pillow包来绘制小猪佩奇,python的安装就不用多说了,直接上代码吧 0.首先当然是安装pillow包啦. 关于pillow库的安装有几种方式 最常使用的是pip安装 ...

  8. python turtle 绘图小猪佩奇,Python使用turtle库绘制小猪佩奇(实例代码)

    这篇文章主要介绍了Python使用turtle库绘制小猪佩奇,本文通过实例代码给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下 turtle(海龟)是Python重要的标准库之一,它 ...

  9. python小猪代码_代码绘制一只小猪佩奇---python篇

    今天教大家用python的pillow包来绘制小猪佩奇,python的安装就不用多说了,直接上代码吧 0.首先当然是安装pillow包啦. 关于pillow库的安装有几种方式 最常使用的是pip安装 ...

  10. 小猪佩奇python_小猪佩奇python代码

    不到两岁的女儿最喜欢小猪佩奇,话都说不明白但是会说peppa pig,足以见得这只猪的魅力.最近也是在学习python,所以找到这个代码,一来运行下哄女儿开心,二来也是再复习下python的语法. m ...

最新文章

  1. 016-热更新之FishingJoy一
  2. perl 分析mysql binlog
  3. vivo分屏_如果你用的是vivo手机,这4个功能别忽略,不然几千块就白花了
  4. 深度学习核心技术精讲100篇(二十四)-简单谈下深度学习在中文分词中的应用
  5. 中嵌协会 第1期“嵌入式与物联网”主题论坛将于2010年6月26日在中关村软件园举行...
  6. 抓localhost包 - rawcap
  7. 笔记 英语二 考研先导课 0126
  8. ctf-HITCON-2016-houseoforange学习
  9. 2020统计局的行政划分表_国家统计局:月入2000-5000元并非“中等收入群体”
  10. 洛谷——P1867 【Mc生存】经验值
  11. java 中阶乘如何表示_Java阶乘实例
  12. Vivado2018的使用
  13. 商城网站前台html模板,网上购物商城前台模板HTML源码
  14. 集成电路的设计 —— 晶体管
  15. cad移动时捕捉不到基点,为什么CAD对象捕捉打开了却捕捉不了?
  16. Fiddler - 使用 Fiddler 监控本地 HTTP 请求,谷歌浏览器提示“隐私设置错误”
  17. 【毕业设计】深度学习图像风格迁移算法研究与实现 - python 卷积神经网络
  18. 机器人中的 jog 是什么意思?
  19. NVIDIA和AMD各型号显卡超频参数一览表
  20. 盛大Everbox邀请码[2011-01-20]

热门文章

  1. minigui 3.2.0:基于miniStudio应用TrueType字体的过程(1)
  2. 选对流程引擎,玩转流程设计不是梦
  3. linux修改只读文件指令,linux修改文件权限
  4. 《菜根谭》 明·洪应明
  5. MAC微信小视频和图片等在本地保存位置地址
  6. python-RFM模型
  7. ajax post forbidden,解决 Ajax 发送 post 请求出现 403 Forbidden 的三种方式
  8. hdu 2036 改革春风吹满地(叉积求多边形面积)
  9. 不同iPhone屏幕尺寸
  10. 「磨金石教育学员插画作业」什么是日系插画?