python turtle 绘制跪坐哭泣小人
时间: 2023-09-28 16:12:17 浏览: 112
以下是使用 Python Turtle 绘制跪坐哭泣小人的示例代码:
```python
import turtle
# 绘制头部
turtle.penup()
turtle.goto(0, 100)
turtle.pendown()
turtle.circle(50)
# 绘制眼睛
turtle.penup()
turtle.goto(-20, 140)
turtle.pendown()
turtle.dot(10)
turtle.penup()
turtle.goto(20, 140)
turtle.pendown()
turtle.dot(10)
# 绘制嘴巴
turtle.penup()
turtle.goto(-25, 120)
turtle.pendown()
turtle.setheading(-60)
turtle.circle(30, 120)
# 绘制身体
turtle.penup()
turtle.goto(0, 50)
turtle.pendown()
turtle.setheading(-90)
turtle.forward(80)
# 绘制双手
turtle.penup()
turtle.goto(-30, 20)
turtle.pendown()
turtle.setheading(-135)
turtle.forward(40)
turtle.penup()
turtle.goto(30, 20)
turtle.pendown()
turtle.setheading(-45)
turtle.forward(40)
# 绘制双腿
turtle.penup()
turtle.goto(-20, 0)
turtle.pendown()
turtle.setheading(-90)
turtle.forward(40)
turtle.penup()
turtle.goto(20, 0)
turtle.pendown()
turtle.setheading(-90)
turtle.forward(40)
# 绘制眼泪
turtle.penup()
turtle.goto(-40, 150)
turtle.pendown()
turtle.setheading(-60)
turtle.circle(10, 120)
turtle.penup()
turtle.goto(40, 150)
turtle.pendown()
turtle.setheading(-120)
turtle.circle(10, 120)
turtle.done()
```
运行代码后,即可在 Turtle 绘图窗口中看到绘制的跪坐哭泣小人。可以根据自己的需求,调整小人的大小、颜色等属性。
阅读全文