用python turtle 画一个小动物
时间: 2023-11-06 16:06:28 浏览: 93
好的,我可以为您画一个小乌龟。
```python
import turtle
# 创建画布
canvas = turtle.Screen()
canvas.bgcolor("white")
# 创建画笔
pen = turtle.Turtle()
pen.speed(0)
# 画乌龟身体
pen.fillcolor("green")
pen.begin_fill()
for i in range(4):
pen.forward(100)
pen.right(90)
pen.end_fill()
# 画乌龟头
pen.penup()
pen.goto(100, 50)
pen.pendown()
pen.fillcolor("light green")
pen.begin_fill()
pen.circle(50)
pen.end_fill()
# 画乌龟眼睛
pen.penup()
pen.goto(130, 70)
pen.pendown()
pen.fillcolor("black")
pen.begin_fill()
pen.circle(10)
pen.end_fill()
# 画乌龟鼻子
pen.penup()
pen.goto(100, 20)
pen.pendown()
pen.fillcolor("black")
pen.begin_fill()
pen.circle(10)
pen.end_fill()
# 隐藏画笔
pen.hideturtle()
# 结束
turtle.done()
```
效果如下:
![小乌龟](https://img-blog.csdnimg.cn/20210415212551149.gif)
阅读全文