用python语言画一个海豚
时间: 2023-10-30 15:06:16 浏览: 181
以下是一个用 Python 画海豚的例子,使用 turtle 库:
```python
import turtle
# 设置画布和海豚的颜色
turtle.bgcolor("#008080")
turtle.color("#F0FFFF")
# 画海豚
turtle.penup()
turtle.goto(-100, 0)
turtle.pendown()
turtle.begin_fill()
turtle.circle(50)
turtle.end_fill()
turtle.penup()
turtle.goto(-70, 40)
turtle.pendown()
turtle.begin_fill()
turtle.circle(15)
turtle.end_fill()
turtle.penup()
turtle.goto(-120, 40)
turtle.pendown()
turtle.begin_fill()
turtle.circle(15)
turtle.end_fill()
turtle.penup()
turtle.goto(-85, -10)
turtle.pendown()
turtle.circle(10)
turtle.penup()
turtle.goto(-135, -10)
turtle.pendown()
turtle.circle(10)
turtle.penup()
turtle.goto(-100, -60)
turtle.pendown()
turtle.goto(50, -60)
turtle.penup()
turtle.goto(-100, -70)
turtle.pendown()
turtle.goto(50, -70)
turtle.done()
```
运行以上代码,就可以看到一个海豚的图案。
阅读全文