著作權宣告:原創不易,本文禁止抄襲、轉載,侵權必究!
一、去吧!皮卡丘!
使用turtle(海龜庫)制作而成,感覺挺好玩的,哈哈@>_<@,效果如下:

由于原始碼過長,這里僅展示部分代碼:
from turtle import * import turtle as t from random import * def infoPrt(): print('coordinate: ' + str(t.pos())) print('angle: ' + str(t.heading())) t.pensize(3) t.hideturtle() t.colormode(255) t.color("black") t.setup(700, 650) t.speed(1) t.st() t.pu() t.goto(-210,86) t.pd() infoPrt() # 頭 print('頭') t.seth(85) t.circle(-100,50) infoPrt() t.seth(25) t.circle(-170,50) infoPrt() # 右耳 print('右耳') t.seth(40) t.circle(-250,30) infoPrt() # 右耳尖 t.begin_fill() # 左 t.circle(-250,22) # 右 t.seth(227) t.circle(-270, 15) prePos = t.pos() infoPrt() # 下 t.seth(105) t.circle(100, 32) t.end_fill() t.pu() t.setpos(prePos) t.pd() t.seth(212) t.circle(-270, 28) prePos = t.pos() t.pu() t.goto(t.xcor()+5,t.ycor()-2) t.pd() # 軀干 print('軀干') t.seth(280) t.circle(500, 30) infoPrt() # 臀部 print('臀部') t.seth(120) t.circle(150, -11) p_tail=t.pos() t.circle(150, -44) p_butt=t.pos() infoPrt() # 尾巴 t.pu() t.setpos(p_tail) t.pd() t.begin_fill() t.seth(50) t.fd(25) t.seth(-50) t.fd(30) p_tail1=t.pos t.seth(-140) t.fd(36) t.end_fill() t.seth(39)
想要學習turtle(海龜庫)的同志可以看官方教程檔案:
https://docs.python.org/3.9/library/turtle.html
四、完整原始碼下載
關注我的原創公眾號【小鴻星空科技】,回復【皮卡丘】關鍵詞獲取完整原始碼
五、作者Info
Author:南柯樹下,Goal:讓編程更有趣!
原創微信公眾號:『小鴻星空科技』,專注于演算法、爬蟲,資料分析、自然語言處理,機器學習等,期待你的關注,讓我們一起成長、一起Coding!
著作權宣告:本文禁止抄襲、轉載 ,侵權必究!
— —— —— —— — END —— —— —— —— ————
歡迎掃碼關注我的公眾號
小鴻星空科技

轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/546806.html
標籤:其他
