python画图哆啦a梦
时间: 2023-10-13 17:21:26 浏览: 26
你可以使用Python中的turtle模块来画出哆啦A梦的形象。以下是一个简单的例子:
```python
import turtle
# 设置画板
t = turtle.Turtle()
t.speed(10)
t.pensize(5)
t.color('blue', '#FCD116')
# 画头部
t.begin_fill()
t.circle(80)
t.end_fill()
# 画眼睛
t.penup()
t.goto(-40, 120)
t.pendown()
t.color('white')
t.begin_fill()
t.circle(20)
t.end_fill()
t.penup()
t.goto(40, 120)
t.pendown()
t.begin_fill()
t.circle(20)
t.end_fill()
# 画瞳孔
t.color('black')
t.penup()
t.goto(-30, 130)
t.pendown()
t.begin_fill()
t.circle(10)
t.end_fill()
t.penup()
t.goto(30, 130)
t.pendown()
t.begin_fill()
t.circle(10)
t.end_fill()
# 画鼻子
t.color('black')
t.penup()
t.goto(0, 80)
t.pendown()
t.begin_fill()
t.circle(10)
t.end_fill()
# 画嘴巴
t.penup()
t.goto(-60, 50)
t.pendown()
t.right(60)
t.circle(80, 120)
# 画身体
t.penup()
t.goto(-80, -80)
t.pendown()
t.color('blue', '#F44336')
t.begin_fill()
t.forward(160)
t.right(90)
t.forward(200)
t.right(90)
t.forward(160)
t.right(90)
t.forward(200)
t.end_fill()
# 画手臂
t.color('blue', '#FCD116')
t.penup()
t.goto(-150, 20)
t.pendown()
t.begin_fill()
t.circle(50, 180)
t.right(180)
t.circle(-50, 180)
t.end_fill()
t.penup()
t.goto(150, 20)
t.pendown()
t.begin_fill()
t.circle(-50, 180)
t.right(180)
t.circle(50, 180)
t.end_fill()
# 画脚
t.color('blue', '#FFE9B4')
t.penup()
t.goto(-50, -220)
t.pendown()
t.begin_fill()
t.circle(50)
t.end_fill()
t.penup()
t.goto(50, -220)
t.pendown()
t.begin_fill()
t.circle(50)
t.end_fill()
turtle.done()
```
运行代码后,你将得到一个画着哆啦A梦的窗口。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.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)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)