用python的turtle画一个QQ的企鹅头像

今天想画个图,看中了桌面上的QQ头像

代码如下:

import turtle


t = turtle.Turtle()
t.speed(0)
#脸
t.color('black')
t.begin_fill()
t.circle(60)
t.end_fill()
#左眼
t.goto(-18,60)
t.pd()
t.color('white')
t.begin_fill()
t.circle(15)
t.end_fill()
t.pu()
t.color('black')

t.goto(-18,75)
t.begin_fill()

t.dot(15)
t.end_fill()

#右眼
t.goto(18,60)
t.pd()
t.color('white')
t.begin_fill()
t.circle(15)
t.end_fill()
t.pu()
t.color('black')
for i in range(8):

    t.goto(16+i,75)
    t.begin_fill()

    t.dot(5)
    t.end_fill()





#嘴巴
#

t.color('yellow')

t.pu()
t.home()

t.goto(-30,40)


t.seth(-35)
t.pd()
t.begin_fill()
t.circle(60,70)
t.pu()
t.goto(35,45)
t.seth(150)


t.pd()
t.circle(60,70)
t.end_fill()

#肚子

t.pu()
t.goto(0,20)
t.seth(180)
t.pensize(10)
t.pd()
t.color('black','white')
t.begin_fill()
t.circle(65)
t.end_fill()
t.pensize(1)

#围巾
t.pu()
t.goto(-55,20)
t.pd()
t.color('red')
t.pensize(32)

t.seth(-20)
t.circle(160,42)
t.pu()
t.pensize(1)
t.goto(-30,0)
t.pd()
t.begin_fill()
t.goto(-5,0)
t.goto(-5,-35)
t.goto(-30,-35)
t.goto(-30,0)
t.end_fill()

#左手
t.goto(-72,20)
t.color('black')
t.begin_fill()

t.goto(-105,-50)
t.goto(-40,0)
t.goto(-72,20)
t.end_fill()
#右手
t.pu()
t.goto(76,20)
t.pd
t.color('black')
t.begin_fill()

t.goto(105,-50)
t.goto(40,0)
t.goto(76,20)
t.end_fill()

#左脚

t.goto(-50,-95)
t.color('yellow')
t.begin_fill()
t.goto(-90,-115)
t.goto(0,-115)
t.goto(-50,-95)
t.end_fill()
#右脚
t.goto(50,-95)
t.color('yellow')
t.begin_fill()
t.goto(90,-115)
t.goto(0,-115)
t.goto(50,-95)
t.end_fill()




t.hideturtle()
turtle.done()

实现效果如下

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值