怎么用python画一个皮卡丘,用python画皮卡丘的代码

大家好,小编来为大家解答以下问题,怎么用python画一个皮卡丘,用python画皮卡丘的代码,今天让我们一起来看看吧!

大家好,小编来为大家解答以下问题,用python画一只可爱的皮卡丘,python画皮卡丘并上色代码,今天让我们一起来看看吧!

给大家看看我的皮卡丘(电脑屏幕比较小,所以看不见假皮卡丘真实的身体):

话不说上代码:

import turtle as t
import random
t.speed(100)
t.pensize(3)
t.color('black')
t.pu()

#头
t.fillcolor('yellow')
t.setposition(-500,300)
t.begin_fill()
t.pd()      
t.left(120)
t.circle(600,-20)
t.pu()
t.left(150)
t.setposition(-500,300)
t.pd()
t.circle(600,25)
t.right(30)
t.circle(150,60)
t.left(15)
t.circle(200,30)
t.left(2)
t.circle(200,50)
t.left(15)
t.circle(150,60)
t.right(90)
t.circle(600,20)
t.left(140)
t.circle(600,25)
t.right(60)
t.circle(150,37)
t.end_fill()
t.pu()

#耳朵涂色

t.setposition(-88,173)
t.fillcolor('black')
t.begin_fill()
t.setposition(-160,162)
t.pd()
t.right(-60)
t.circle(60,50)
t.end_fill()

t.pu()
t.setposition(-500,300)
t.fillcolor('black')
t.begin_fill()
t.pd()
t.setposition(-460,215)
t.right(-90)
t.circle(60,-65)
t.end_fill()
t.pu()

#眼睛
t.fillcolor('black')
t.begin_fill()

t.setposition(-470,0)
t.pd()
t.circle(20,360)
t.end_fill()

t.pu()
t.fillcolor('black')
t.begin_fill()
t.setposition(-350,-5)
t.pd()
t.circle(20,360)
t.end_fill()
t.pu()


#眼睛白
t.fillcolor('white')
t.begin_fill()

t.setposition(-470,10)
t.pd()
t.circle(10,360)
t.end_fill()

t.pu()
t.fillcolor('white')
t.begin_fill()
t.setposition(-350,5)
t.pd()
t.circle(10,360)
t.end_fill()
t.pu()

#鼻子
t.pensize(8)
t.setposition(-410,-20)
t.pd()
t.goto(-395,-20)
t.pu()

#嘴巴
t.setposition(-450,-35)
t.fillcolor("red")
t.begin_fill()
t.pd()
t.circle(45,60)
t.right(53)
t.circle(45,60)
t.pu()
t.setposition(-445,-37)
t.right(115)
t.pd()
t.circle(300,17)
t.left(20)
t.circle(70,10)
t.left(15)
t.circle(70,10)
t.left(15)
t.circle(70,10)
t.left(15)
t.circle(70,10)
t.left(15)
t.circle(70,10)
t.left(5)
t.circle(70,10)
t.left(4)
t.circle(370,10)
t.end_fill()
t.up()

#腮红
t.pensize(5)
t.setposition(-290,-50)

t.fillcolor("red")
t.begin_fill()
t.pd()
t.circle(20,360)
t.left(20)
t.end_fill()
t.pu()


t.setposition(-480,-50)
t.pd()
t.fillcolor("red")
t.begin_fill()
t.circle(20,360)
t.left(20)
t.end_fill()
t.pu()

#身体
t.setposition(-480,-135)

t.fillcolor("yellow")
t.begin_fill()
t.pensize(3)

t.pd()
t.right(240)
t.circle(900,20)
t.pu()

t.setposition(-300,-129)
t.pd()
t.circle(900,25)
t.end_fill()
t.pu()

#尾巴
t.setposition(-285,-250)
t.pd()
t.fillcolor("yellow")
t.begin_fill()
t.goto(-260,-230)
t.goto(-210,-240)
t.goto(-140,-190)
t.goto(-60,-200)
t.goto(-65,-270)
t.goto(-145,-230)
t.goto(-215,-260)
t.goto(-260,-240)
t.goto(-285,-255)
t.end_fill()
t.done()

猜你喜欢

转载自blog.csdn.net/mynote/article/details/133531904