用简单python画一个史迪仔
时间: 2023-07-01 12:20:48 浏览: 476
好的,以下是一个简单的Python代码,可以画一个史迪仔:
```python
import turtle
# 画身体
turtle.penup()
turtle.goto(0, -100)
turtle.pendown()
turtle.circle(100)
# 画头
turtle.penup()
turtle.goto(0, 0)
turtle.pendown()
turtle.circle(70)
# 画耳朵
turtle.penup()
turtle.goto(40, 70)
turtle.pendown()
turtle.circle(20)
turtle.penup()
turtle.goto(-40, 70)
turtle.pendown()
turtle.circle(20)
# 画眼睛
turtle.penup()
turtle.goto(25, 30)
turtle.pendown()
turtle.begin_fill()
turtle.circle(10)
turtle.end_fill()
turtle.penup()
turtle.goto(-25, 30)
turtle.pendown()
turtle.begin_fill()
turtle.circle(10)
turtle.end_fill()
# 画嘴巴
turtle.penup()
turtle.goto(0, 10)
turtle.pendown()
turtle.circle(30, -180)
# 画胡须
turtle.penup()
turtle.goto(30, -10)
turtle.pendown()
turtle.goto(80, -30)
turtle.penup()
turtle.goto(30, -20)
turtle.pendown()
turtle.goto(80, -20)
turtle.penup()
turtle.goto(30, -30)
turtle.pendown()
turtle.goto(80, -10)
turtle.penup()
turtle.goto(-30, -10)
turtle.pendown()
turtle.goto(-80, -30)
turtle.penup()
turtle.goto(-30, -20)
turtle.pendown()
turtle.goto(-80, -20)
turtle.penup()
turtle.goto(-30, -30)
turtle.pendown()
turtle.goto(-80, -10)
turtle.done()
```
运行代码后,就会在窗口中画出一个史迪仔!
阅读全文