用python画小黄人
时间: 2023-07-12 09:49:03 浏览: 147
好的,以下是使用Python绘制小黄人的代码:
```python
import turtle
# 设置画布大小
turtle.setup(800, 600)
# 画小黄人的身体
turtle.penup()
turtle.goto(0, -200)
turtle.pendown()
turtle.begin_fill()
turtle.color("yellow")
turtle.circle(200)
turtle.end_fill()
# 画小黄人的眼睛
turtle.penup()
turtle.goto(-70, 80)
turtle.pendown()
turtle.begin_fill()
turtle.color("white")
turtle.circle(50)
turtle.end_fill()
turtle.penup()
turtle.goto(-70, 100)
turtle.pendown()
turtle.begin_fill()
turtle.color("black")
turtle.circle(20)
turtle.end_fill()
turtle.penup()
turtle.goto(70, 80)
turtle.pendown()
turtle.begin_fill()
turtle.color("white")
turtle.circle(50)
turtle.end_fill()
turtle.penup()
turtle.goto(70, 100)
turtle.pendown()
turtle.begin_fill()
turtle.color("black")
turtle.circle(20)
turtle.end_fill()
# 画小黄人的嘴巴
turtle.penup()
turtle.goto(-100, -60)
turtle.pendown()
turtle.right(60)
turtle.circle(120, 120)
# 画小黄人的手臂
turtle.penup()
turtle.goto(-200, -100)
turtle.pendown()
turtle.right(60)
turtle.forward(150)
turtle.penup()
turtle.goto(200, -100)
turtle.pendown()
turtle.left(120)
turtle.forward(150)
# 完成绘制
turtle.done()
```
运行代码后,就可以看到小黄人的形状了!
阅读全文
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)