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

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

1 importturtle as t2

3

4 defnose():5 t.penup()6 t.seth(90)7 t.fd(100)8 t.pendown()9 t.begin_fill()10 t.fillcolor('black')11 t.seth(45)12 t.fd(25)13 t.seth(135)14 t.circle(25, 90)15 t.seth(315)16 t.fd(25)17 t.end_fill()18

19

20 defeyes(seth, fd, c):21 t.penup()22 t.seth(seth)23 t.fd(fd)24 t.pendown()25 t.begin_fill()26 t.fillcolor('black')27 t.circle(50)28 t.end_fill()29

30 t.penup()31 t.circle(50, c)32 t.pendown()33 t.begin_fill()34 t.fillcolor('white')35 t.circle(20)36 t.end_fill()37

38

39 defface(seth, fd):40 t.penup()41 t.seth(seth)42 t.fd(fd)43 t.pendown()44 t.begin_fill()45 t.fillcolor('red')46 t.circle(70)47 t.end_fill()48

49

50 deflip():51 t.penup()52 t.seth(135)53 t.fd(250)54 t.pendown()55 t.seth(-300)56 t.circle(30, -65)57 t.begin_fill()58 t.fillcolor('Firebrick')59 t.seth(165)60 t.fd(140)61 t.seth(195)62 t.fd(140)63 t.seth(-360)64 t.circle(30, -65)65 t.penup()66 t.seth(-60)67 t.circle(30, 65)68 t.pendown()69 t.seth(-70)70 t.fd(240)71 t.circle(55, 140)72 t.seth(70)73 t.fd(240)74 t.end_fill()75 t.seth(-110)76 t.fd(80)77 t.begin_fill()78 t.fillcolor('Firebrick1')79 t.seth(120)80 t.circle(120, 123)81 t.seth(-70)82 t.fd(165)83 t.circle(55, 140)84 t.seth(72)85 t.fd(165)86 t.end_fill()87

88

89 defsetting():90 t.pensize(4)91 t.hideturtle()92 t.setup(1000, 600)93 t.speed(10)94 t.screensize(bg='yellow')95

96

97 defmain():98 setting()99 nose()100 eyes(160, 250, 60)101 eyes(-9.5, 530, 230)102 face(195, 600)103 face(-11, 720)104 lip()105 t.done()106

107

108 if __name__ == '__main__':109 main()

  • 24
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值