如何使用python绘制皮卡丘

大家好,我是于翱睿,今天我给大家分享如何使用python绘制皮卡丘

画完之后,会有一个方形的皮卡丘的脸

如果还有什么绘图的创意,请写信给我。

import turtle as t
def background():
    t.penup()
    t.left(180)
    t.fd(500)
    t.right(90)
    t.fd(300)
    t.pendown
    t.pencolor('yellow')
    t.begin_fill()
    t.fillcolor('yellow')
    t.right(90)
    t.fd(1000)
    t.right(90)
    t.fd(600)
    t.right(90)
    t.fd(1000)
    t.right(90)
    t.fd(600)
    t.end_fill()
    t.penup()
    t.pencolor('black')
    t.right(90)
    t.fd(500)
    t.right(90)
    t.fd(200)
    t.left(90)
    t.pendown()

def nose():
    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('pink')
    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()

t.speed(0)
background()
nose()
eyes(160, 250, 60)
eyes(-9.5, 530, 230)
face(195, 600)
face(-11, 720)
lip()
t.done()

执行以上代码,运行之后会得到一个如图的皮卡丘

以上就是本期的内容

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值