帮我用Python画个草莓熊
时间: 2023-11-19 15:06:59 浏览: 62
好的,以下是基于Python Turtle模块的草莓熊的绘制代码,希望你能喜欢:
```python
import turtle
# 设置画笔的颜色和宽度
turtle.pensize(4)
turtle.pencolor('black')
# 绘制草莓
turtle.fillcolor('red')
turtle.begin_fill()
turtle.circle(80)
turtle.end_fill()
# 绘制草莓的脸
turtle.penup()
turtle.goto(-35, 120)
turtle.pendown()
turtle.fillcolor('white')
turtle.begin_fill()
turtle.circle(20)
turtle.end_fill()
# 绘制草莓的耳朵
turtle.penup()
turtle.goto(0, 150)
turtle.pendown()
turtle.fillcolor('green')
turtle.begin_fill()
turtle.right(40)
turtle.circle(40, 80)
turtle.left(40)
turtle.circle(40, 80)
turtle.end_fill()
# 绘制草莓的眼睛
turtle.penup()
turtle.goto(-20, 140)
turtle.pendown()
turtle.fillcolor('black')
turtle.begin_fill()
turtle.circle(5)
turtle.end_fill()
turtle.penup()
turtle.goto(20, 140)
turtle.pendown()
turtle.fillcolor('black')
turtle.begin_fill()
turtle.circle(5)
turtle.end_fill()
# 绘制草莓的鼻子
turtle.penup()
turtle.goto(0, 120)
turtle.pendown()
turtle.fillcolor('black')
turtle.begin_fill()
turtle.circle(10)
turtle.end_fill()
# 绘制草莓的嘴巴
turtle.penup()
turtle.goto(-30, 100)
turtle.pendown()
turtle.right(90)
turtle.circle(30, 180)
# 绘制草莓熊的身体
turtle.penup()
turtle.goto(-100, -100)
turtle.pendown()
turtle.fillcolor('brown')
turtle.begin_fill()
turtle.forward(200)
turtle.right(90)
turtle.forward(150)
turtle.right(90)
turtle.forward(200)
turtle.right(90)
turtle.forward(150)
turtle.end_fill()
# 绘制草莓熊的脚
turtle.penup()
turtle.goto(-100, -100)
turtle.pendown()
turtle.fillcolor('brown')
turtle.begin_fill()
turtle.right(45)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(135)
turtle.forward(75)
turtle.end_fill()
turtle.penup()
turtle.goto(100, -100)
turtle.pendown()
turtle.fillcolor('brown')
turtle.begin_fill()
turtle.right(45)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(135)
turtle.forward(75)
turtle.end_fill()
# 绘制草莓熊的手
turtle.penup()
turtle.goto(100, 50)
turtle.pendown()
turtle.fillcolor('brown')
turtle.begin_fill()
turtle.right(45)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(135)
turtle.forward(75)
turtle.end_fill()
turtle.penup()
turtle.goto(-100, 50)
turtle.pendown()
turtle.fillcolor('brown')
turtle.begin_fill()
turtle.right(45)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(135)
turtle.forward(75)
turtle.end_fill()
# 隐藏画笔
turtle.hideturtle()
# 点击关闭窗口
turtle.exitonclick()
```
执行以上代码后,会弹出一个窗口,显示出草莓熊的图案。
阅读全文