python计算机图形学画简笔画 大白
时间: 2023-07-25 14:48:13 浏览: 186
python画画
5星 · 资源好评率100%
要用Python画出大白的简笔画,可以借助Python中的turtle库,它专门用于绘制图形和动画。
下面是一个用turtle库绘制大白的简笔画的示例代码:
```
import turtle
# 设置画笔颜色和大小
turtle.color('white', 'white')
turtle.pensize(5)
# 绘制大白的头部
turtle.begin_fill()
turtle.circle(100)
turtle.end_fill()
# 绘制大白的眼睛
turtle.penup()
turtle.goto(-40, 120)
turtle.pendown()
turtle.color('black', 'black')
turtle.begin_fill()
turtle.circle(20)
turtle.end_fill()
turtle.penup()
turtle.goto(40, 120)
turtle.pendown()
turtle.begin_fill()
turtle.circle(20)
turtle.end_fill()
# 绘制大白的嘴巴
turtle.penup()
turtle.goto(-60, 60)
turtle.pendown()
turtle.color('red', 'red')
turtle.begin_fill()
turtle.right(90)
turtle.circle(60, 180)
turtle.end_fill()
# 绘制大白的身体
turtle.penup()
turtle.goto(-150, -50)
turtle.pendown()
turtle.color('white', 'white')
turtle.begin_fill()
turtle.right(90)
turtle.forward(200)
turtle.right(90)
turtle.forward(300)
turtle.right(90)
turtle.forward(200)
turtle.right(90)
turtle.forward(300)
turtle.end_fill()
# 绘制大白的手臂
turtle.penup()
turtle.goto(-150, -50)
turtle.pendown()
turtle.color('black', 'white')
turtle.begin_fill()
turtle.right(45)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(45)
turtle.end_fill()
turtle.penup()
turtle.goto(150, -50)
turtle.pendown()
turtle.color('black', 'white')
turtle.begin_fill()
turtle.left(45)
turtle.forward(100)
turtle.left(90)
turtle.forward(100)
turtle.left(45)
turtle.end_fill()
# 绘制大白的脚
turtle.penup()
turtle.goto(-100, -250)
turtle.pendown()
turtle.color('black', 'white')
turtle.begin_fill()
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(50)
turtle.end_fill()
turtle.penup()
turtle.goto(100, -250)
turtle.pendown()
turtle.color('black', 'white')
turtle.begin_fill()
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(50)
turtle.end_fill()
# 隐藏画笔
turtle.hideturtle()
# 显示绘制结果
turtle.done()
```
运行上述代码,即可在窗口中看到一个用turtle库绘制的大白的简笔画。
阅读全文