用turtle写出汪泳燊
时间: 2024-05-28 16:13:59 浏览: 47
使用Python的turtle写字
以下是使用Turtle库写出汪泳燊的代码示例:
```python
import turtle
# 创建画布
canvas = turtle.Screen()
canvas.bgcolor("white")
# 创建画笔
pen = turtle.Turtle()
pen.hideturtle()
pen.speed(10)
# 写出汪泳燊
pen.pu()
pen.goto(-100, 0)
pen.color("blue")
pen.write("汪泳燊", font=("Arial", 30, "bold"))
# 绘制头像
pen.pensize(4)
pen.pencolor("blue")
pen.fillcolor("yellow")
pen.pu()
pen.goto(50, 0)
pen.pd()
pen.begin_fill()
pen.circle(50)
pen.end_fill()
# 绘制眼睛
pen.pu()
pen.goto(30, 20)
pen.pd()
pen.fillcolor("white")
pen.begin_fill()
pen.circle(15)
pen.end_fill()
pen.pu()
pen.goto(30, 30)
pen.pd()
pen.fillcolor("black")
pen.begin_fill()
pen.circle(5)
pen.end_fill()
pen.pu()
pen.goto(70, 20)
pen.pd()
pen.fillcolor("white")
pen.begin_fill()
pen.circle(15)
pen.end_fill()
pen.pu()
pen.goto(70, 30)
pen.pd()
pen.fillcolor("black")
pen.begin_fill()
pen.circle(5)
pen.end_fill()
# 绘制嘴巴
pen.pu()
pen.goto(50, -20)
pen.pd()
pen.fillcolor("red")
pen.begin_fill()
pen.circle(20, 180)
pen.end_fill()
# 完成绘制
turtle.done()
```
效果如下:
![汪泳燊](https://img-blog.csdnimg.cn/20210901192251960.png)
阅读全文