python海龟杰尼龟
时间: 2023-12-08 22:39:39 浏览: 166
以下是使用Python turtle库绘制海龟杰尼龟的代码和效果图:
```python
import turtle
# 设置画布大小和背景颜色
turtle.setup(800, 600)
turtle.bgcolor("white")
# 设置画笔颜色和大小
turtle.pensize(4)
turtle.pencolor("blue")
# 绘制海龟杰尼龟的头部
turtle.circle(100)
# 绘制海龟杰尼龟的眼睛
turtle.penup()
turtle.goto(-40, 120)
turtle.pendown()
turtle.circle(20)
turtle.penup()
turtle.goto(40, 120)
turtle.pendown()
turtle.circle(20)
# 绘制海龟杰尼龟的身体
turtle.penup()
turtle.goto(0, 0)
turtle.pendown()
turtle.circle(150)
# 绘制海龟杰尼龟的四肢
turtle.penup()
turtle.goto(-150, -150)
turtle.pendown()
turtle.circle(50, 90)
turtle.penup()
turtle.goto(150, -150)
turtle.pendown()
turtle.circle(-50, 90)
turtle.penup()
turtle.goto(-150, -250)
turtle.pendown()
turtle.circle(50, 90)
turtle.penup()
turtle.goto(150, -250)
turtle.pendown()
turtle.circle(-50, 90)
# 隐藏画笔
turtle.hideturtle()
# 显示绘制结果
turtle.done()
```
绘制结果如下图所示:
![turtle_jenigui](https://i.imgur.com/5JZJzvL.png)
阅读全文