用python写一个画一个皮卡丘的脚本
时间: 2024-05-06 22:19:14 浏览: 8
好的,以下是Python代码:
```python
import turtle
# 设置画笔
t = turtle.Turtle()
t.speed(10)
t.pensize(5)
t.hideturtle()
# 画皮卡丘主体
t.penup()
t.goto(-150, 0)
t.pendown()
t.color('#FDD835', '#FDD835')
t.begin_fill()
t.left(90)
t.forward(100)
t.circle(50, -180)
t.forward(300)
t.circle(50, -180)
t.forward(100)
t.right(90)
t.circle(100, -180)
t.right(90)
t.forward(200)
t.end_fill()
# 画眼睛
t.penup()
t.goto(-30, 200)
t.pendown()
t.color('white', 'white')
t.begin_fill()
t.circle(30)
t.end_fill()
t.penup()
t.goto(-40, 190)
t.pendown()
t.color('black', 'black')
t.begin_fill()
t.circle(10)
t.end_fill()
t.penup()
t.goto(60, 200)
t.pendown()
t.color('white', 'white')
t.begin_fill()
t.circle(30)
t.end_fill()
t.penup()
t.goto(50, 190)
t.pendown()
t.color('black', 'black')
t.begin_fill()
t.circle(10)
t.end_fill()
# 画嘴巴
t.penup()
t.goto(-100, 50)
t.pendown()
t.color('black', 'black')
t.begin_fill()
t.right(90)
t.circle(50, -180)
t.left(145)
t.circle(100, -35)
t.end_fill()
# 画脸颊
t.penup()
t.goto(-150, -30)
t.pendown()
t.color('#FFB6C1', '#FFB6C1')
t.begin_fill()
t.right(105)
t.circle(60, -180)
t.end_fill()
t.penup()
t.goto(160, -30)
t.pendown()
t.color('#FFB6C1', '#FFB6C1')
t.begin_fill()
t.right(180)
t.circle(60, -180)
t.end_fill()
# 完成
turtle.done()
```
运行以上代码会看到一个皮卡丘画在屏幕上。希望对你有所帮助!
相关推荐
![md](https://img-home.csdnimg.cn/images/20210720083646.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.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)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![xlsx](https://img-home.csdnimg.cn/images/20210720083732.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)