用python turtle画一个老鹰复杂图,有颜色
时间: 2024-06-14 21:05:25 浏览: 103
好的,以下是一个用Python turtle模块画老鹰的示例代码,它包含了颜色和复杂的图形:
```python
import turtle
# 设置画布大小和背景颜色
turtle.setup(800, 600)
turtle.bgcolor("white")
# 定义画笔颜色和线条宽度
turtle.color("black", "yellow")
turtle.pensize(2)
# 开始绘制老鹰
turtle.begin_fill()
# 绘制头部
turtle.forward(100)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.left(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
# 绘制眼睛
turtle.penup()
turtle.goto(75, 25)
turtle.pendown()
turtle.color("black", "white")
turtle.begin_fill()
turtle.circle(10)
turtle.end_fill()
# 绘制瞳孔
turtle.penup()
turtle.goto(80, 25)
turtle.pendown()
turtle.color("black", "black")
turtle.begin_fill()
turtle.circle(5)
turtle.end_fill()
# 绘制身体
turtle.penup()
turtle.goto(100, 0)
turtle.pendown()
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(100)
# 绘制尾巴
turtle.penup()
turtle.goto(150, -50)
turtle.pendown()
turtle.right(45)
turtle.forward(50)
turtle.right(135)
turtle.forward(50)
# 绘制翅膀
turtle.penup()
turtle.goto(100, 50)
turtle.pendown()
turtle.right(45)
turtle.forward(50)
turtle.right(135)
turtle.forward(50)
# 结束绘制老鹰
turtle.end_fill()
# 隐藏画笔
turtle.hideturtle()
# 显示绘制结果
turtle.done()
```
阅读全文