python画哆啦a梦
时间: 2023-10-12 07:10:31 浏览: 55
可以使用turtle库来画出哆啦A梦的形状,以下是一个简单的实现:
```python
import turtle
# 设置画笔
t = turtle.Turtle()
t.pensize(4)
t.speed(10)
# 画哆啦A梦的头
t.circle(100)
t.fillcolor("#00A1E4")
t.begin_fill()
t.circle(100)
t.end_fill()
# 画哆啦A梦的脸部
t.penup()
t.goto(0, 70)
t.pendown()
t.fillcolor("#ffffff")
t.begin_fill()
t.circle(70)
t.end_fill()
# 画哆啦A梦的鼻子
t.penup()
t.goto(0, 20)
t.pendown()
t.fillcolor("#ff0000")
t.begin_fill()
t.circle(20)
t.end_fill()
# 画哆啦A梦的眼睛
t.penup()
t.goto(-45, 120)
t.pendown()
t.fillcolor("#ffffff")
t.begin_fill()
t.circle(20)
t.end_fill()
t.penup()
t.goto(-45, 130)
t.pendown()
t.fillcolor("#000000")
t.begin_fill()
t.circle(10)
t.end_fill()
t.penup()
t.goto(45, 120)
t.pendown()
t.fillcolor("#ffffff")
t.begin_fill()
t.circle(20)
t.end_fill()
t.penup()
t.goto(45, 130)
t.pendown()
t.fillcolor("#000000")
t.begin_fill()
t.circle(10)
t.end_fill()
# 画哆啦A梦的胡须
t.penup()
t.goto(-70, 80)
t.pendown()
t.right(20)
t.forward(60)
t.penup()
t.goto(-70, 60)
t.pendown()
t.right(20)
t.forward(60)
t.penup()
t.goto(-70, 40)
t.pendown()
t.right(20)
t.forward(60)
t.penup()
t.goto(70, 80)
t.pendown()
t.left(20)
t.forward(60)
t.penup()
t.goto(70, 60)
t.pendown()
t.left(20)
t.forward(60)
t.penup()
t.goto(70, 40)
t.pendown()
t.left(20)
t.forward(60)
# 完成画图
turtle.done()
```
运行以上代码,就可以看到哆啦A梦的形状啦。
阅读全文
相关推荐















