python海龟绘图画新一
时间: 2023-11-08 20:04:55 浏览: 123
好的,以下是使用Python海龟绘图画新一的代码:
```python
import turtle
# 设置画笔
pen = turtle.Turtle()
pen.speed(10)
pen.pensize(5)
# 画头
pen.fillcolor('#FCD5B5')
pen.begin_fill()
pen.circle(100)
pen.end_fill()
# 画眼睛
pen.penup()
pen.goto(-40, 120)
pen.pendown()
pen.fillcolor('white')
pen.begin_fill()
pen.circle(20)
pen.end_fill()
pen.penup()
pen.goto(40, 120)
pen.pendown()
pen.begin_fill()
pen.circle(20)
pen.end_fill()
# 画瞳孔
pen.penup()
pen.goto(-40, 130)
pen.pendown()
pen.fillcolor('black')
pen.begin_fill()
pen.circle(10)
pen.end_fill()
pen.penup()
pen.goto(40, 130)
pen.pendown()
pen.begin_fill()
pen.circle(10)
pen.end_fill()
# 画鼻子
pen.penup()
pen.goto(0, 80)
pen.pendown()
pen.fillcolor('#FCD5B5')
pen.begin_fill()
pen.circle(30)
pen.end_fill()
# 画嘴巴
pen.penup()
pen.goto(-60, 50)
pen.pendown()
pen.right(45)
pen.circle(80, 90)
# 画身体
pen.penup()
pen.goto(-150, -100)
pen.pendown()
pen.fillcolor('#FCD5B5')
pen.begin_fill()
for i in range(2):
pen.forward(300)
pen.circle(50, 180)
pen.end_fill()
# 画手
def draw_hand(x, y):
pen.penup()
pen.goto(x, y)
pen.pendown()
pen.fillcolor('#FCD5B5')
pen.begin_fill()
pen.circle(30)
pen.end_fill()
draw_hand(-200, -100)
draw_hand(200, -100)
# 画脚
def draw_foot(x, y):
pen.penup()
pen.goto(x, y)
pen.pendown()
pen.fillcolor('#FCD5B5')
pen.begin_fill()
pen.circle(50)
pen.end_fill()
draw_foot(-100, -300)
draw_foot(100, -300)
# 隐藏画笔
pen.hideturtle()
# 等待点击关闭窗口
turtle.done()
```
阅读全文