Python:26皮卡皮卡皮卡丘笑臉

哈哈哈哈,卡哇伊代碼獻上啦^_^:

import turtle as t

def nose():
    t.penup()
    t.seth(90)
    t.fd(100)
    t.pendown()
    t.begin_fill()
    t.fillcolor("black")
    t.seth(45)
    t.fd(25)
    t.seth(135)
    t.circle(25,90)
    t.seth(315)
    t.fd(25)
    t.end_fill()
    
def eyes(seth,fd,c):
    t.penup()
    t.seth(seth)
    t.fd(fd)
    t.pendown()
    t.begin_fill()
    t.fillcolor('black')
    t.circle(50)
    t.end_fill()
    t.penup()
    t.circle(50,c)
    t.pendown()
    t.begin_fill()
    t.fillcolor('white')
    t.circle(20)
    t.end_fill()
    
def face(seth,fd):
    t.penup()
    t.seth(seth)
    t.fd(fd)
    t.pendown()
    t.begin_fill()
    t.fillcolor('red')
    t.circle(70)
    t.end_fill()
    
def lip():
    t.penup()
    t.seth(135)
    t.fd(250)
    t.pendown()
    t.seth(-300)
    t.circle(30,-65)
    t.begin_fill()
    t.fillcolor('Firebrick')
    t.seth(165)
    t.fd(140)
    t.seth(195)
    t.fd(140)
    t.seth(-360)
    t.circle(30,-65)
    t.penup()
    t.seth(-60)
    t.circle(30,65)
    t.pendown()
    t.seth(-70)
    t.fd(240)
    t.circle(55,140)
    t.seth(70)
    t.fd(240)
    t.end_fill()
    t.seth(-110)
    t.fd(80)
    t.begin_fill()
    t.fillcolor('Firebrick')
    t.seth(120)
    t.circle(120,123)
    t.seth(-70)
    t.fd(165)
    t.circle(55,140)
    t.seth(72)
    t.fd(165)
    t.end_fill()
    
def setting():
    t.pensize(4)
    t.hideturtle()
    t.setup(1000,600)
    t.speed(10)
    t.screensize(bg='yellow')
    
def main():
    setting()
    nose()
    eyes(160,250,60)
    eyes(-9.5,530,230)
    face(195,600)
    face(-11,720)
    lip()
    t.done()
    
if __name__ == '__main__':
    main()
運行結果:

 往期回顧:用Python畫一整隻小皮卡丘https://blog.csdn.net/weixin_44015669/article/details/105169801
用Python畫小豬佩奇https://blog.csdn.net/weixin_44015669/article/details/105169549
用Python畫大白https://mp.csdn.net/console/editor/html/105170167更多畫畫可關注小編了解哦!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章