用turtle画皮卡丘
时间: 2023-07-28 17:06:51 浏览: 110
好的,请先确保您已经安装了Python的turtle模块。以下是用turtle画皮卡丘的代码:
```python
import turtle
# 设置画笔的初始位置
turtle.penup()
turtle.goto(-50, 150)
turtle.pendown()
# 画皮卡丘的头部
turtle.begin_fill()
turtle.color("yellow")
turtle.circle(100)
turtle.end_fill()
# 画皮卡丘的眼睛
turtle.penup()
turtle.goto(-40, 200)
turtle.pendown()
turtle.begin_fill()
turtle.color("white")
turtle.circle(20)
turtle.end_fill()
turtle.penup()
turtle.goto(-40, 210)
turtle.pendown()
turtle.begin_fill()
turtle.color("black")
turtle.circle(10)
turtle.end_fill()
turtle.penup()
turtle.goto(40, 200)
turtle.pendown()
turtle.begin_fill()
turtle.color("white")
turtle.circle(20)
turtle.end_fill()
turtle.penup()
turtle.goto(40, 210)
turtle.pendown()
turtle.begin_fill()
turtle.color("black")
turtle.circle(10)
turtle.end_fill()
# 画皮卡丘的鼻子
turtle.penup()
turtle.goto(0, 150)
turtle.pendown()
turtle.begin_fill()
turtle.color("black")
turtle.circle(10)
turtle.end_fill()
# 画皮卡丘的嘴巴
turtle.penup()
turtle.goto(-50, 100)
turtle.pendown()
turtle.right(90)
turtle.circle(50, 180)
# 画皮卡丘的腮红
turtle.penup()
turtle.goto(-90, 140)
turtle.pendown()
turtle.begin_fill()
turtle.color("pink")
turtle.circle(20)
turtle.end_fill()
turtle.penup()
turtle.goto(90, 140)
turtle.pendown()
turtle.begin_fill()
turtle.color("pink")
turtle.circle(20)
turtle.end_fill()
# 画皮卡丘的耳朵
turtle.penup()
turtle.goto(-100, 220)
turtle.pendown()
turtle.begin_fill()
turtle.color("yellow")
turtle.right(45)
turtle.circle(50, -90)
turtle.right(45)
turtle.circle(50, -90)
turtle.end_fill()
turtle.penup()
turtle.goto(100, 220)
turtle.pendown()
turtle.begin_fill()
turtle.color("yellow")
turtle.left(45)
turtle.circle(50, 90)
turtle.left(45)
turtle.circle(50, 90)
turtle.end_fill()
# 画皮卡丘的身体
turtle.penup()
turtle.goto(-100, 0)
turtle.pendown()
turtle.begin_fill()
turtle.color("yellow")
turtle.circle(100)
turtle.end_fill()
turtle.penup()
turtle.goto(-150, -50)
turtle.pendown()
turtle.begin_fill()
turtle.color("brown")
turtle.circle(50)
turtle.end_fill()
turtle.penup()
turtle.goto(-85, -75)
turtle.pendown()
turtle.begin_fill()
turtle.color("brown")
turtle.right(45)
turtle.circle(30, -90)
turtle.right(45)
turtle.circle(30, -90)
turtle.end_fill()
turtle.penup()
turtle.goto(50, -50)
turtle.pendown()
turtle.begin_fill()
turtle.color("brown")
turtle.circle(50)
turtle.end_fill()
turtle.penup()
turtle.goto(85, -75)
turtle.pendown()
turtle.begin_fill()
turtle.color("brown")
turtle.left(45)
turtle.circle(30, 90)
turtle.left(45)
turtle.circle(30, 90)
turtle.end_fill()
# 完成画图
turtle.hideturtle()
turtle.done()
```
运行以上代码,就可以看到绘制好的皮卡丘啦!
阅读全文