Python+Turtle繪制可愛的多啦A夢(mèng)的示例代碼
1 送她的多啦A夢(mèng)
一個(gè)哆啦A夢(mèng)讓她開心開心好久好久。我也很開心,昨天送了一個(gè)實(shí)體模型,今天用Python代碼再弄一個(gè)送給她。
哆啦A夢(mèng)(日語:ドラえもん,英語:Doraemon),舊譯為機(jī)器貓,日本漫畫《多啦A夢(mèng)》及其衍生作品中的貓型機(jī)器人,本作的主人公。名字的意思是銅鑼(ドラ)衛(wèi)門(えもん)。
哆啦A夢(mèng)肚子上擁有四次元口袋,這個(gè)口袋直接通往四次元空間,再多的東西也放得下。害怕老鼠。平時(shí)的職責(zé)是照顧野比大雄。
2 白駒過隙
雖說雁過無痕,歲月無聲,而白駒過隙的光陰卻在生命的每個(gè)角落不著痕跡的流,總是蕩漾在我渺遠(yuǎn)的心跡,很懷念。讓它停留在記憶的沙灘上,混入蚌中,化作一顆最美的珍珠.....
她的光環(huán)
天空很蔚藍(lán)也是你的主色
我送你的紅禮巾系著金色鈴鐺
最后的擁抱你像棉花糖一樣樣的柔軟哆啦A夢(mèng)
請(qǐng)把我最珍貴的東西
都裝進(jìn)你的百寶袋
3 Python代碼實(shí)現(xiàn)
import turtle as t # t.speed(3) t.title('我的小公主,哆啦A夢(mèng)') 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.08 t.lt(3) # 向左轉(zhuǎn)3度 t.fd(a) # 向前走a的步長(zhǎng) else: a = a - 0.08 t.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.08 t.lt(3) # 向左轉(zhuǎn)3度 t.fd(a) # 向前走a的步長(zhǎng) else: a = a - 0.08 t.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() #====領(lǐng)帶===== 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()
到此這篇關(guān)于Python+Turtle繪制可愛的多啦A夢(mèng)的示例代碼的文章就介紹到這了,更多相關(guān)Python Turtle多啦A夢(mèng)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
pytest文檔內(nèi)置fixture的request詳情
這篇文章主要介紹了pytest文檔內(nèi)置fixture的request詳情,文章圍繞主題展開詳細(xì)的內(nèi)容介紹,具有一定的參考價(jià)值,需要的小伙伴可以參考一下2022-08-08Python+Pygame實(shí)現(xiàn)代碼雨動(dòng)畫效果
這篇文章主要為大家詳細(xì)介紹了python中的一個(gè)小項(xiàng)目:利用pygame實(shí)現(xiàn)代碼雨動(dòng)畫效果,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以嘗試一下2022-11-11Python進(jìn)階學(xué)習(xí)之帶你探尋Python類的鼻祖-元類
這篇文章主要介紹了Python進(jìn)階學(xué)習(xí)之帶你探尋Python類的鼻祖-元類,文中有非常詳細(xì)的解釋,對(duì)正在學(xué)習(xí)python的小伙伴們有很好的幫助,需要的朋友可以參考下2021-05-05python網(wǎng)絡(luò)爬蟲精解之正則表達(dá)式的使用說明
正則表達(dá)式是對(duì)字符串操作的一種邏輯公式,就是用事先定義好的一些特定字符、及這些特定字符的組合,組成一個(gè)“規(guī)則字符串”,這個(gè)“規(guī)則字符串”用來表達(dá)對(duì)字符串的一種過濾邏輯2021-09-09Python安裝Numpy和matplotlib的方法(推薦)
下面小編就為大家?guī)硪黄狿ython安裝Numpy和matplotlib的方法(推薦)。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-11-11簡(jiǎn)單了解python的內(nèi)存管理機(jī)制
這篇文章主要介紹了簡(jiǎn)單了解python的內(nèi)存管理機(jī)制,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-07-07python下實(shí)現(xiàn)二叉堆以及堆排序的示例
下面小編就為大家?guī)硪黄猵ython下實(shí)現(xiàn)二叉堆以及堆排序的示例。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-09-09