python画蜡笔小新吃包子代码
时间: 2023-11-12 20:57:19 浏览: 211
以下是使用Python的turtle库画蜡笔小新吃包子的代码:
```python
import turtle
# 设置画布大小和背景颜色
turtle.setup(800, 600)
turtle.bgcolor("#FCDFFF")
# 画小新的头
turtle.penup()
turtle.goto(-100, 100)
turtle.pendown()
turtle.fillcolor("#FFD8D8")
turtle.begin_fill()
turtle.circle(50)
turtle.end_fill()
# 画小新的身体
turtle.penup()
turtle.goto(-100, 50)
turtle.pendown()
turtle.fillcolor("#FFD8D8")
turtle.begin_fill()
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.end_fill()
# 画小新的手
turtle.penup()
turtle.goto(-150, 50)
turtle.pendown()
turtle.fillcolor("#FFD8D8")
turtle.begin_fill()
turtle.right(45)
turtle.forward(70)
turtle.right(45)
turtle.forward(50)
turtle.right(45)
turtle.forward(70)
turtle.right(135)
turtle.forward(50)
turtle.end_fill()
# 画小新的脚
turtle.penup()
turtle.goto(-100, -50)
turtle.pendown()
turtle.fillcolor("#FFD8D8")
turtle.begin_fill()
turtle.right(45)
turtle.forward(70)
turtle.right(45)
turtle.forward(50)
turtle.right(45)
turtle.forward(70)
turtle.right(135)
turtle.forward(50)
turtle.end_fill()
# 画包子
turtle.penup()
turtle.goto(50, 0)
turtle.pendown()
turtle.fillcolor("#FFFF00")
turtle.begin_fill()
turtle.circle(30)
turtle.end_fill()
# 画包子的馅
turtle.penup()
turtle.goto(40, 10)
turtle.pendown()
turtle.fillcolor("#FFA500")
turtle.begin_fill()
turtle.circle(10)
turtle.end_fill()
# 画小新的嘴巴
turtle.penup()
turtle.goto(-80, 120)
turtle.pendown()
turtle.right(60)
turtle.circle(30, 120)
# 隐藏画笔
turtle.hideturtle()
# 等待用户关闭窗口
turtle.done()
```
阅读全文