python画美羊羊
时间: 2023-10-22 07:10:49 浏览: 174
您可以使用Python的turtle库来画美羊羊。以下是一个简单的示例代码:
```python
import turtle
# 设置画笔颜色和粗细
turtle.pensize(5)
turtle.pencolor('pink')
# 画羊身体
turtle.circle(100)
# 画羊头
turtle.penup()
turtle.goto(50, 150)
turtle.pendown()
turtle.circle(50)
# 画羊眼睛
turtle.penup()
turtle.goto(70, 180)
turtle.pendown()
turtle.dot(20)
turtle.penup()
turtle.goto(110, 180)
turtle.pendown()
turtle.dot(20)
# 画羊嘴巴
turtle.penup()
turtle.goto(70, 150)
turtle.pendown()
turtle.right(60)
turtle.circle(30, 120)
# 画羊腿
turtle.penup()
turtle.goto(-50, -100)
turtle.pendown()
turtle.right(30)
turtle.forward(80)
turtle.right(90)
turtle.forward(50)
turtle.penup()
turtle.goto(50, -100)
turtle.pendown()
turtle.left(60)
turtle.forward(80)
turtle.left(90)
turtle.forward(50)
# 隐藏画笔
turtle.hideturtle()
# 显示画布
turtle.done()
```
阅读全文