懒羊羊python代码
时间: 2023-11-08 11:04:34 浏览: 225
以下是绘制懒羊羊的Python代码:
```python
import turtle
# 设置画布和画笔
canvas = turtle.Screen()
canvas.bgcolor("white")
pen = turtle.Turtle()
pen.speed(2)
# 绘制身体
pen.penup()
pen.goto(-50, -50)
pen.pendown()
pen.circle(50)
# 绘制头部
pen.penup()
pen.goto(-70, 40)
pen.pendown()
pen.circle(20)
# 绘制眼睛
pen.penup()
pen.goto(-60, 50)
pen.pendown()
pen.dot(5)
pen.penup()
pen.goto(-80, 50)
pen.pendown()
pen.dot(5)
# 绘制嘴巴
pen.penup()
pen.goto(-70, 30)
pen.pendown()
pen.goto(-60, 30)
# 绘制耳朵
pen.penup()
pen.goto(-90, 60)
pen.pendown()
pen.goto(-70, 90)
pen.goto(-50, 60)
# 绘制腿
pen.penup()
pen.goto(-70, -50)
pen.pendown()
pen.goto(-90, -80)
pen.penup()
pen.goto(-70, -50)
pen.pendown()
pen.goto(-50, -80)
# 绘制尾巴
pen.penup()
pen.goto(-20, -50)
pen.pendown()
pen.goto(-20, 0)
# 隐藏画笔
pen.hideturtle()
# 关闭画布
turtle.done()
```
阅读全文