turtle 绘制笑脸表情符号

turtle 绘制笑脸表情符号,如图所示

要求:

1. 脸蛋半径100,颜色黄色

2. 左右眼睛半径15,坐标依次(-40,120), (40,120)

3. 左右眼球半径5,颜色黑色,坐标依次(-40, 125), (40, 125)

4. 嘴巴半径40,颜色黑色,坐标(-40, 85)

5. 鼻子半径8,颜色黑色,坐标(0, 75)

6. 舌头半径10,颜色红色,坐标(-10, 45)

7. 绘制结束后隐藏小海龟 

参考代码

import turtle

def eye(col, rad):
    turtle.pendown()
    turtle.fillcolor(col)
    turtle.begin_fill()
    turtle.circle(rad)
    turtle.end_fill()
    turtle.penup()

# 画脸
turtle.fillcolor('yellow')
turtle.begin_fill()
turtle.circle(100)
turtle.end_fill()
turtle.penup()

# 左眼
turtle.goto(-40, 120)
eye('white', 15)
turtle.goto(-40, 125)
eye('black', 5)

# 右眼
turtle.goto(40, 120)
eye('white', 15)
turtle.goto(40, 125)
eye('black', 5)

# 鼻子
turtle.goto(0, 75)
eye('black', 8)

# 嘴巴
turtle.goto(-40, 85)
turtle.pendown()
turtle.right(90)
turtle.circle(40, 180)
turtle.penup()

# 舌头
turtle.goto(-10, 45)
turtle.pendown()
turtle.right(180)
turtle.fillcolor('red')
turtle.begin_fill()
turtle.circle(10, 180)
turtle.end_fill()


turtle.hideturtle()
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值