python画图代码美少女战士
时间: 2023-11-09 14:01:36 浏览: 171
python中关于绘图的代码
以下是一个简单的Python画图代码,可以画出美少女战士的头像:
```python
import turtle
# 设置画布大小和背景颜色
turtle.setup(600, 600)
turtle.bgcolor("#F5F5F5")
# 画圆形头像
turtle.penup()
turtle.goto(0, -200)
turtle.pendown()
turtle.begin_fill()
turtle.color("#FCCAC2")
turtle.circle(200)
turtle.end_fill()
# 画眼睛
turtle.penup()
turtle.goto(-80, 80)
turtle.pendown()
turtle.begin_fill()
turtle.color("#FFFFFF")
turtle.circle(50)
turtle.end_fill()
turtle.penup()
turtle.goto(80, 80)
turtle.pendown()
turtle.begin_fill()
turtle.color("#FFFFFF")
turtle.circle(50)
turtle.end_fill()
# 画瞳孔
turtle.penup()
turtle.goto(-80, 80)
turtle.pendown()
turtle.begin_fill()
turtle.color("#000000")
turtle.circle(20)
turtle.end_fill()
turtle.penup()
turtle.goto(80, 80)
turtle.pendown()
turtle.begin_fill()
turtle.color("#000000")
turtle.circle(20)
turtle.end_fill()
# 画嘴巴
turtle.penup()
turtle.goto(0, 0)
turtle.pendown()
turtle.width(10)
turtle.color("#E84C3D")
turtle.right(90)
turtle.circle(100, 180)
# 隐藏画笔
turtle.hideturtle()
# 等待用户关闭窗口
turtle.done()
```
阅读全文