用·Python画一个玲娜贝儿
时间: 2023-11-16 20:16:57 浏览: 303
使用Python 绘画一个 皮卡丘
下面是使用Python的turtle库绘制玲娜贝儿的示例代码:
```python
import turtle
# 设置画笔
turtle.setup(800, 600)
turtle.pensize(3)
turtle.speed(10)
# 画头发
turtle.penup()
turtle.goto(-150, 150)
turtle.pendown()
turtle.begin_fill()
turtle.color("black")
turtle.circle(100, 220)
turtle.goto(-150, 150)
turtle.end_fill()
# 画脸
turtle.penup()
turtle.goto(0, 0)
turtle.pendown()
turtle.begin_fill()
turtle.color("white")
turtle.circle(100)
turtle.end_fill()
# 画眼睛
turtle.penup()
turtle.goto(-40, 40)
turtle.pendown()
turtle.begin_fill()
turtle.color("black")
turtle.circle(20)
turtle.end_fill()
turtle.penup()
turtle.goto(40, 40)
turtle.pendown()
turtle.begin_fill()
turtle.color("black")
turtle.circle(20)
turtle.end_fill()
turtle.penup()
turtle.goto(-30, 50)
turtle.pendown()
turtle.begin_fill()
turtle.color("white")
turtle.circle(8)
turtle.end_fill()
turtle.penup()
turtle.goto(50, 50)
turtle.pendown()
turtle.begin_fill()
turtle.color("white")
turtle.circle(8)
turtle.end_fill()
# 画嘴巴
turtle.penup()
turtle.goto(-40, 0)
turtle.pendown()
turtle.right(45)
turtle.circle(70, 90)
turtle.penup()
turtle.goto(-40, 0)
turtle.pendown()
turtle.left(180)
turtle.circle(-70, 90)
# 画身体
turtle.penup()
turtle.goto(0, -100)
turtle.pendown()
turtle.begin_fill()
turtle.color("white")
turtle.circle(100)
turtle.end_fill()
# 画裙子
turtle.penup()
turtle.goto(-100, -100)
turtle.pendown()
turtle.begin_fill()
turtle.color("red")
turtle.circle(50, 180)
turtle.goto(-100, -100)
turtle.end_fill()
# 画手
turtle.penup()
turtle.goto(-100, -150)
turtle.pendown()
turtle.begin_fill()
turtle.color("white")
turtle.circle(30)
turtle.end_fill()
turtle.penup()
turtle.goto(100, -150)
turtle.pendown()
turtle.begin_fill()
turtle.color("white")
turtle.circle(30)
turtle.end_fill()
# 画腿
turtle.penup()
turtle.goto(-50, -250)
turtle.pendown()
turtle.begin_fill()
turtle.color("white")
turtle.circle(30)
turtle.end_fill()
turtle.penup()
turtle.goto(50, -250)
turtle.pendown()
turtle.begin_fill()
turtle.color("white")
turtle.circle(30)
turtle.end_fill()
# 隐藏画笔
turtle.hideturtle()
# 显示绘图窗口
turtle.done()
```
运行代码后,将会在窗口中显示出玲娜贝儿的图案。您可以根据自己的需求进行修改和美化。
阅读全文