python代码绘制草莓熊送花
时间: 2023-10-14 12:05:59 浏览: 221
以下是Python代码绘制草莓熊送花的过程:
```python
import turtle
# 设置画布大小和背景颜色
turtle.setup(800, 600)
turtle.bgcolor('#FEECEA')
# 绘制草莓熊的头部
turtle.penup()
turtle.goto(-100, 100)
turtle.pendown()
turtle.fillcolor('#FCD5B5')
turtle.begin_fill()
turtle.circle(80)
turtle.end_fill()
# 绘制草莓熊的耳朵
turtle.penup()
turtle.goto(-60, 180)
turtle.pendown()
turtle.fillcolor('#FCD5B5')
turtle.begin_fill()
turtle.circle(30)
turtle.end_fill()
turtle.penup()
turtle.goto(-140, 180)
turtle.pendown()
turtle.fillcolor('#FCD5B5')
turtle.begin_fill()
turtle.circle(30)
turtle.end_fill()
# 绘制草莓熊的眼睛
turtle.penup()
turtle.goto(-70, 120)
turtle.pendown()
turtle.fillcolor('white')
turtle.begin_fill()
turtle.circle(15)
turtle.end_fill()
turtle.penup()
turtle.goto(-130, 120)
turtle.pendown()
turtle.fillcolor('white')
turtle.begin_fill()
turtle.circle(15)
turtle.end_fill()
# 绘制草莓熊的眼珠子
turtle.penup()
turtle.goto(-70, 130)
turtle.pendown()
turtle.fillcolor('black')
turtle.begin_fill()
turtle.circle(7)
turtle.end_fill()
turtle.penup()
turtle.goto(-130, 130)
turtle.pendown()
turtle.fillcolor('black')
turtle.begin_fill()
turtle.circle(7)
turtle.end_fill()
# 绘制草莓熊的鼻子
turtle.penup()
turtle.goto(-100, 100)
turtle.pendown()
turtle.fillcolor('#F88D9E')
turtle.begin_fill()
turtle.circle(20)
turtle.end_fill()
# 绘制草莓熊的嘴巴
turtle.penup()
turtle.goto(-100, 80)
turtle.pendown()
turtle.pensize(5)
turtle.right(90)
turtle.circle(20, 180)
# 绘制草莓熊的身体
turtle.penup()
turtle.goto(-100, 0)
turtle.pendown()
turtle.fillcolor('#FCD5B5')
turtle.begin_fill()
turtle.circle(100)
turtle.end_fill()
# 绘制草莓熊的手臂
turtle.penup()
turtle.goto(-200, 0)
turtle.pendown()
turtle.fillcolor('#FCD5B5')
turtle.begin_fill()
turtle.circle(30)
turtle.end_fill()
turtle.penup()
turtle.goto(0, 0)
turtle.pendown()
turtle.fillcolor('#FCD5B5')
turtle.begin_fill()
turtle.circle(30)
turtle.end_fill()
# 绘制草莓熊的脚
turtle.penup()
turtle.goto(-70, -120)
turtle.pendown()
turtle.fillcolor('#FCD5B5')
turtle.begin_fill()
turtle.circle(30)
turtle.end_fill()
turtle.penup()
turtle.goto(-130, -120)
turtle.pendown()
turtle.fillcolor('#FCD5B5')
turtle.begin_fill()
turtle.circle(30)
turtle.end_fill()
# 绘制草莓熊手中的花
turtle.penup()
turtle.goto(100, 0)
turtle.pendown()
turtle.fillcolor('#F88D9E')
turtle.begin_fill()
turtle.circle(20)
turtle.end_fill()
turtle.penup()
turtle.goto(100, 20)
turtle.pendown()
turtle.fillcolor('#FEECEA')
turtle.begin_fill()
turtle.circle(10)
turtle.end_fill()
turtle.penup()
turtle.goto(100, -20)
turtle.pendown()
turtle.fillcolor('#FEECEA')
turtle.begin_fill()
turtle.circle(10)
turtle.end_fill()
# 隐藏画笔
turtle.hideturtle()
# 显示绘图窗口
turtle.done()
```
阅读全文