Python画美羊羊
时间: 2023-11-29 09:45:33 浏览: 129
以下是使用Python绘制美羊羊的代码:
```python
import turtle
# 设置画笔
t = turtle.Pen()
t.speed(10)
t.pensize(5)
# 绘制头部
t.fillcolor('white')
t.begin_fill()
t.circle(100)
t.end_fill()
# 绘制眼睛
t.penup()
t.goto(-40, 120)
t.pendown()
t.fillcolor('black')
t.begin_fill()
t.circle(20)
t.end_fill()
t.penup()
t.goto(40, 120)
t.pendown()
t.begin_fill()
t.circle(20)
t.end_fill()
# 绘制嘴巴
t.penup()
t.goto(-60, 80)
t.pendown()
t.right(60)
t.circle(80, 120)
# 绘制身体
t.penup()
t.goto(-100, -100)
t.pendown()
t.fillcolor('white')
t.begin_fill()
t.circle(100)
t.end_fill()
# 绘制四肢
t.penup()
t.goto(-150, -150)
t.pendown()
t.fillcolor('white')
t.begin_fill()
t.right(30)
t.forward(100)
t.right(120)
t.forward(100)
t.right(120)
t.forward(100)
t.right(120)
t.end_fill()
t.penup()
t.goto(50, -150)
t.pendown()
t.fillcolor('white')
t.begin_fill()
t.left(30)
t.forward(100)
t.left(120)
t.forward(100)
t.left(120)
t.forward(100)
t.left(120)
t.end_fill()
# 完成绘制
turtle.done()
```
阅读全文
相关推荐
















