turtle函数画海绵宝宝
时间: 2023-10-03 16:08:32 浏览: 166
python用turtle画画
抱歉,作为一名AI语言模型,我不能直接画图,但我可以提供代码供您参考:
```python
import turtle
# 设置画板
screen = turtle.Screen()
screen.bgcolor("lightblue")
# 设置画笔
spongebob = turtle.Turtle()
spongebob.color("yellow")
spongebob.pensize(3)
spongebob.speed(10)
# 画海绵宝宝的头
spongebob.begin_fill()
spongebob.circle(100)
spongebob.end_fill()
# 画眼睛
spongebob.penup()
spongebob.goto(-40, 120)
spongebob.pendown()
spongebob.begin_fill()
spongebob.color("white")
spongebob.circle(20)
spongebob.end_fill()
spongebob.penup()
spongebob.goto(-40, 130)
spongebob.pendown()
spongebob.begin_fill()
spongebob.color("black")
spongebob.circle(10)
spongebob.end_fill()
spongebob.penup()
spongebob.goto(40, 120)
spongebob.pendown()
spongebob.begin_fill()
spongebob.color("white")
spongebob.circle(20)
spongebob.end_fill()
spongebob.penup()
spongebob.goto(40, 130)
spongebob.pendown()
spongebob.begin_fill()
spongebob.color("black")
spongebob.circle(10)
spongebob.end_fill()
# 画鼻子
spongebob.penup()
spongebob.goto(0, 80)
spongebob.pendown()
spongebob.begin_fill()
spongebob.color("red")
spongebob.circle(15)
spongebob.end_fill()
# 画嘴巴
spongebob.penup()
spongebob.goto(-60, 40)
spongebob.pendown()
spongebob.right(45)
spongebob.circle(80, 90)
# 画牙齿
spongebob.penup()
spongebob.goto(-25, 30)
spongebob.pendown()
spongebob.color("white")
spongebob.begin_fill()
spongebob.forward(30)
spongebob.left(90)
spongebob.forward(20)
spongebob.left(90)
spongebob.forward(30)
spongebob.end_fill()
# 画身体
spongebob.penup()
spongebob.goto(-120, -50)
spongebob.pendown()
spongebob.begin_fill()
spongebob.color("brown")
spongebob.forward(240)
spongebob.right(90)
spongebob.circle(100, 180)
spongebob.right(90)
spongebob.forward(240)
spongebob.end_fill()
# 画裤子
spongebob.penup()
spongebob.goto(-80, -150)
spongebob.pendown()
spongebob.begin_fill()
spongebob.color("white")
spongebob.forward(160)
spongebob.right(90)
spongebob.forward(60)
spongebob.right(90)
spongebob.forward(160)
spongebob.right(90)
spongebob.forward(60)
spongebob.end_fill()
# 画鞋子
spongebob.penup()
spongebob.goto(-110, -210)
spongebob.pendown()
spongebob.begin_fill()
spongebob.color("black")
spongebob.forward(60)
spongebob.right(90)
spongebob.forward(30)
spongebob.right(90)
spongebob.forward(60)
spongebob.right(90)
spongebob.forward(30)
spongebob.end_fill()
spongebob.penup()
spongebob.goto(50, -210)
spongebob.pendown()
spongebob.begin_fill()
spongebob.color("black")
spongebob.forward(60)
spongebob.right(90)
spongebob.forward(30)
spongebob.right(90)
spongebob.forward(60)
spongebob.right(90)
spongebob.forward(30)
spongebob.end_fill()
# 画手
spongebob.penup()
spongebob.goto(-200, 0)
spongebob.pendown()
spongebob.begin_fill()
spongebob.color("yellow")
spongebob.right(20)
spongebob.forward(80)
spongebob.right(70)
spongebob.forward(40)
spongebob.right(110)
spongebob.forward(80)
spongebob.end_fill()
spongebob.penup()
spongebob.goto(120, 0)
spongebob.pendown()
spongebob.begin_fill()
spongebob.color("yellow")
spongebob.left(20)
spongebob.forward(80)
spongebob.left(70)
spongebob.forward(40)
spongebob.left(110)
spongebob.forward(80)
spongebob.end_fill()
# 完成
turtle.done()
```
阅读全文