python画樱桃小丸子代码
时间: 2023-11-13 13:54:52 浏览: 251
以下是使用Python绘制樱桃小丸子的代码:
```python
import turtle
# 设置画布大小和背景颜色
turtle.setup(800, 600)
turtle.bgcolor('#FEECEA')
# 绘制小丸子的脸
turtle.penup()
turtle.goto(-100, 50)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('#F8B4D9')
turtle.circle(100)
turtle.end_fill()
# 绘制小丸子的眼睛
turtle.penup()
turtle.goto(-60, 120)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('white')
turtle.circle(30)
turtle.end_fill()
turtle.penup()
turtle.goto(-60, 130)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('black')
turtle.circle(15)
turtle.end_fill()
turtle.penup()
turtle.goto(40, 120)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('white')
turtle.circle(30)
turtle.end_fill()
turtle.penup()
turtle.goto(40, 130)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('black')
turtle.circle(15)
turtle.end_fill()
# 绘制小丸子的嘴巴
turtle.penup()
turtle.goto(-70, 20)
turtle.pendown()
turtle.pensize(10)
turtle.right(90)
turtle.circle(70, 180)
# 绘制小丸子的腮红
turtle.penup()
turtle.goto(-130, 70)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('#F8B4D9')
turtle.circle(30)
turtle.end_fill()
turtle.penup()
turtle.goto(70, 70)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('#F8B4D9')
turtle.circle(30)
turtle.end_fill()
# 隐藏画笔
turtle.hideturtle()
# 等待用户关闭窗口
turtle.done()
```
阅读全文