Python用turtle画生气符号的代码
时间: 2023-08-21 09:14:17 浏览: 127
使用python的turtle画蛋糕实例代码.rar
以下是Python使用turtle库画生气符号的代码:
```python
import turtle
turtle.speed(0)
# 画眼睛
turtle.penup()
turtle.goto(-100, 100)
turtle.pendown()
turtle.fillcolor("white")
turtle.begin_fill()
turtle.circle(50)
turtle.end_fill()
turtle.penup()
turtle.goto(100, 100)
turtle.pendown()
turtle.fillcolor("white")
turtle.begin_fill()
turtle.circle(50)
turtle.end_fill()
# 画眼珠
turtle.penup()
turtle.goto(-75, 150)
turtle.pendown()
turtle.fillcolor("black")
turtle.begin_fill()
turtle.circle(15)
turtle.end_fill()
turtle.penup()
turtle.goto(75, 150)
turtle.pendown()
turtle.fillcolor("black")
turtle.begin_fill()
turtle.circle(15)
turtle.end_fill()
# 画眉毛
turtle.penup()
turtle.goto(-150, 200)
turtle.pendown()
turtle.pensize(10)
turtle.right(90)
turtle.forward(50)
turtle.penup()
turtle.goto(150, 200)
turtle.pendown()
turtle.left(180)
turtle.forward(50)
# 画嘴巴
turtle.penup()
turtle.goto(-100, 0)
turtle.pendown()
turtle.pensize(15)
turtle.right(180)
turtle.circle(100, -180)
# 画气泡
turtle.penup()
turtle.goto(0, -200)
turtle.pendown()
turtle.fillcolor("white")
turtle.begin_fill()
turtle.circle(100)
turtle.end_fill()
turtle.penup()
turtle.goto(0, -100)
turtle.pendown()
turtle.right(90)
turtle.write("生气", font=("Arial", 24, "bold"), align="center")
turtle.done()
```
运行代码后,会画出一个生气的表情符号,包括两个眼睛、眼珠、眉毛、嘴巴和一个气泡。
阅读全文