用python写一个草莓熊
时间: 2024-05-29 11:04:58 浏览: 8
草莓熊是一种可爱的卡通形象,如果你想用Python来绘制一个草莓熊,你可以使用Python的turtle模块来实现。下面是一个简单的草莓熊绘制代码:
```python
import turtle
# 设置画笔
turtle.pensize(4)
turtle.pencolor('black')
turtle.fillcolor('pink')
# 绘制草莓
turtle.begin_fill()
turtle.circle(100)
turtle.end_fill()
# 绘制熊耳朵
turtle.penup()
turtle.goto(-50, 200)
turtle.pendown()
turtle.begin_fill()
turtle.circle(50)
turtle.end_fill()
turtle.penup()
turtle.goto(50, 200)
turtle.pendown()
turtle.begin_fill()
turtle.circle(50)
turtle.end_fill()
# 绘制熊眼睛
turtle.penup()
turtle.goto(-30, 250)
turtle.pendown()
turtle.fillcolor('white')
turtle.begin_fill()
turtle.circle(20)
turtle.end_fill()
turtle.penup()
turtle.goto(30, 250)
turtle.pendown()
turtle.begin_fill()
turtle.circle(20)
turtle.end_fill()
turtle.fillcolor('black')
turtle.penup()
turtle.goto(-30, 260)
turtle.pendown()
turtle.begin_fill()
turtle.circle(10)
turtle.end_fill()
turtle.penup()
turtle.goto(30, 260)
turtle.pendown()
turtle.begin_fill()
turtle.circle(10)
turtle.end_fill()
# 绘制熊嘴巴
turtle.penup()
turtle.goto(-50, 180)
turtle.pendown()
turtle.pencolor('black')
turtle.fillcolor('white')
turtle.begin_fill()
turtle.right(45)
turtle.forward(70)
turtle.right(90)
turtle.forward(70)
turtle.right(135)
turtle.forward(100)
turtle.end_fill()
# 绘制熊鼻子
turtle.penup()
turtle.goto(0, 220)
turtle.pendown()
turtle.fillcolor('black')
turtle.begin_fill()
turtle.circle(10)
turtle.end_fill()
# 绘制熊手
turtle.penup()
turtle.goto(-150, 0)
turtle.pendown()
turtle.fillcolor('pink')
turtle.begin_fill()
turtle.right(45)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(135)
turtle.forward(140)
turtle.end_fill()
turtle.penup()
turtle.goto(150, 0)
turtle.pendown()
turtle.fillcolor('pink')
turtle.begin_fill()
turtle.right(45)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(135)
turtle.forward(140)
turtle.end_fill()
# 绘制熊脚
turtle.penup()
turtle.goto(-50, -150)
turtle.pendown()
turtle.fillcolor('pink')
turtle.begin_fill()
turtle.right(45)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(135)
turtle.forward(140)
turtle.end_fill()
turtle.penup()
turtle.goto(50, -150)
turtle.pendown()
turtle.fillcolor('pink')
turtle.begin_fill()
turtle.right(45)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(135)
turtle.forward(140)
turtle.end_fill()
# 隐藏画笔
turtle.hideturtle()
# 显示绘图窗口
turtle.done()
```
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)