turtle画哆啦a梦头部
时间: 2023-11-04 07:05:02 浏览: 31
好的,以下是使用Python的turtle库画出哆啦A梦头部的代码:
```python
import turtle
# 设置画笔
t = turtle.Turtle()
t.speed(10)
t.pensize(3)
t.penup()
t.goto(0, -200)
t.pendown()
# 画头部
t.fillcolor("#00A1D9")
t.begin_fill()
t.circle(200)
t.end_fill()
# 画脸部
t.fillcolor("#FFFFFF")
t.begin_fill()
t.circle(150)
t.end_fill()
# 画耳朵
t.penup()
t.goto(-100, 100)
t.pendown()
t.fillcolor("#00A1D9")
t.begin_fill()
for i in range(3):
t.forward(120)
t.left(120)
t.end_fill()
t.penup()
t.goto(100, 100)
t.pendown()
t.fillcolor("#00A1D9")
t.begin_fill()
for i in range(3):
t.forward(120)
t.right(120)
t.end_fill()
# 画眼睛
t.penup()
t.goto(-80, 20)
t.pendown()
t.fillcolor("#FFFFFF")
t.begin_fill()
t.circle(40)
t.end_fill()
t.penup()
t.goto(80, 20)
t.pendown()
t.fillcolor("#FFFFFF")
t.begin_fill()
t.circle(40)
t.end_fill()
t.penup()
t.goto(-60, 30)
t.pendown()
t.fillcolor("#000000")
t.begin_fill()
t.circle(20)
t.end_fill()
t.penup()
t.goto(60, 30)
t.pendown()
t.fillcolor("#000000")
t.begin_fill()
t.circle(20)
t.end_fill()
# 画鼻子
t.penup()
t.goto(0, 0)
t.pendown()
t.fillcolor("#FFD200")
t.begin_fill()
t.circle(30)
t.end_fill()
# 画嘴巴
t.penup()
t.goto(-80, -80)
t.pendown()
t.right(90)
t.circle(80, 180)
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)
![](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)