python代码画樱桃小丸子
时间: 2023-09-22 21:11:22 浏览: 165
以下是使用Python Turtle模块画樱桃小丸子的代码:
```python
import turtle
# 设置画布大小
turtle.setup(800,600)
# 画小丸子头部
turtle.penup()
turtle.goto(-100,100)
turtle.pendown()
turtle.begin_fill()
turtle.color('#FCD5C5')
turtle.circle(70)
turtle.end_fill()
# 画小丸子眼睛和嘴巴
turtle.penup()
turtle.goto(-60,180)
turtle.pendown()
turtle.begin_fill()
turtle.color('white')
turtle.circle(20)
turtle.end_fill()
turtle.penup()
turtle.goto(0,180)
turtle.pendown()
turtle.begin_fill()
turtle.color('white')
turtle.circle(20)
turtle.end_fill()
turtle.penup()
turtle.goto(-30,150)
turtle.pendown()
turtle.color('black')
turtle.width(5)
turtle.forward(60)
# 画小丸子身体
turtle.penup()
turtle.goto(-100,30)
turtle.pendown()
turtle.begin_fill()
turtle.color('#F6A5A5')
turtle.circle(100)
turtle.end_fill()
turtle.penup()
turtle.goto(-100,0)
turtle.pendown()
turtle.begin_fill()
turtle.color('#FCD5C5')
turtle.circle(100)
turtle.end_fill()
turtle.penup()
turtle.goto(-100,-30)
turtle.pendown()
turtle.begin_fill()
turtle.color('#F6A5A5')
turtle.circle(100)
turtle.end_fill()
# 画小丸子脚
turtle.penup()
turtle.goto(-30,-150)
turtle.pendown()
turtle.begin_fill()
turtle.color('white')
turtle.circle(30)
turtle.end_fill()
turtle.penup()
turtle.goto(30,-150)
turtle.pendown()
turtle.begin_fill()
turtle.color('white')
turtle.circle(30)
turtle.end_fill()
# 画樱桃
turtle.penup()
turtle.goto(100,100)
turtle.pendown()
turtle.color('red')
turtle.begin_fill()
turtle.circle(30)
turtle.end_fill()
turtle.penup()
turtle.goto(85,130)
turtle.pendown()
turtle.color('green')
turtle.begin_fill()
turtle.circle(10)
turtle.end_fill()
turtle.hideturtle()
turtle.done()
```
运行代码,将会在画布上显示出樱桃小丸子的图像。
阅读全文