温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Python+Turtle如何绘制可爱的多啦A梦

发布时间:2022-03-18 11:24:29 阅读:174 作者:小新 栏目:开发技术
Python开发者专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

小编给大家分享一下Python+Turtle如何绘制可爱的多啦A梦,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

1 送她的多啦A梦

一个哆啦A梦让她开心开心好久好久。我也很开心,昨天送了一个实体模型,今天用Python代码再弄一个送给她。

Python+Turtle如何绘制可爱的多啦A梦

哆啦A梦(日语:ドラえもん,英语:Doraemon),旧译为机器猫,日本漫画《多啦A梦》及其衍生作品中的猫型机器人,本作的主人公。名字的意思是铜锣(ドラ)卫门(えもん)。

哆啦A梦肚子上拥有四次元口袋,这个口袋直接通往四次元空间,再多的东西也放得下。害怕老鼠。平时的职责是照顾野比大雄。

Python+Turtle如何绘制可爱的多啦A梦

2 白驹过隙 

虽说雁过无痕,岁月无声,而白驹过隙的光阴却在生命的每个角落不着痕迹的流,总是荡漾在我渺远的心迹,很怀念。让它停留在记忆的沙滩上,混入蚌中,化作一颗最美的珍珠.....

她的光环

天空很蔚蓝也是你的主色

我送你的红礼巾系着金色铃铛

最后的拥抱你像棉花糖一样样的柔软哆啦A梦

请把我最珍贵的东西

都装进你的百宝袋

3 Python代码实现

Python+Turtle如何绘制可爱的多啦A梦

import turtle as t
# t.speed(3)
t.title('我的小公主,哆啦A梦')
t.pensize(8)
t.hideturtle()
t.screensize(500500, 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(0134)
t.pd()
t.pensize(4)
t.fillcolor("#EA0014")
t.begin_fill()
t.circle(18)
t.end_fill()
t.pu()
t.goto(7155)
t.pensize(2)
t.color('white''white')
t.pd()
t.begin_fill()
t.circle(4)
t.end_fill()
t.pu()
t.goto(-30160)
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.08
        t.lt(3)  # 向左转3度
        t.fd(a)  # 向前走a的步长
    else:
        a = a - 0.08
        t.lt(3)
        t.fd(a)
t.end_fill()
t.pu()
t.goto(30160)
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.08
        t.lt(3)  # 向左转3度
        t.fd(a)  # 向前走a的步长
    else:
        a = a - 0.08
        t.lt(3)
        t.fd(a)
t.end_fill()
t.pu()
t.goto(-38190)
t.pensize(8)
t.pd()
t.right(-30)
t.forward(15)
t.right(70)
t.forward(15)
t.pu()
t.goto(15185)
t.pensize(4)
t.pd()
t.color('black''black')
t.begin_fill()
t.circle(13)
t.end_fill()
t.pu()
t.goto(13190)
t.pensize(2)
t.pd()
t.color('white''white')
t.begin_fill()
t.circle(5)
t.end_fill()
t.pu()
t.home()
t.goto(0134)
t.pensize(4)
t.pencolor('black')
t.pd()
t.right(90)
t.forward(40)
t.pu()
t.home()
t.goto(0124)
t.pensize(3)
t.pencolor('black')
t.pd()
t.left(10)
t.forward(80)
t.pu()
t.home()
t.goto(0114)
t.pensize(3)
t.pencolor('black')
t.pd()
t.left(6)
t.forward(80)
t.pu()
t.home()
t.goto(0104)
t.pensize(3)
t.pencolor('black')
t.pd()
t.left(0)
t.forward(80)
 
#====左边的胡子====
t.pu()
t.home()
t.goto(0124)
t.pensize(3)
t.pencolor('black')
t.pd()
t.left(170)
t.forward(80)
t.pu()
t.home()
t.goto(0114)
t.pensize(3)
t.pencolor('black')
t.pd()
t.left(174)
t.forward(80)
t.pu()
t.home()
t.goto(0104)
t.pensize(3)
t.pencolor('black')
t.pd()
t.left(180)
t.forward(80)
t.pu()
t.goto(-7070)
t.pd()
t.color('black''red')
t.pensize(6)
t.seth(-60)
t.begin_fill()
t.circle(8040)
t.circle(8080)
t.end_fill()
t.pu()
t.home()
t.goto(-8070)
t.pd()
t.forward(160)
t.pu()
t.home()
t.goto(-5050)
t.pd()
t.pensize(1)
t.fillcolor("#eb6e1a")
t.seth(40)
t.begin_fill()
t.circle(-4040)
t.circle(-4040)
t.seth(40)
t.circle(-4040)
t.circle(-4040)
t.seth(220)
t.circle(-8040)
t.circle(-8040)
t.end_fill()
 
#====领带=====
t.pu()
t.goto(-7012)
t.pensize(14)
t.pencolor('red')
t.pd()
t.seth(-20)
t.circle(20030)
t.circle(20010)
 
#====铃铛=====
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()

以上是“Python+Turtle如何绘制可爱的多啦A梦”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI

开发者交流群×