This is the 10th day of my participation in the August More Text Challenge. For details, see:August is more challenging

Spongebob squarepants

Tool use

Development tools: pycharm development environment: python3.7, Windows10 use kit: turtle

Results show

Project idea Analysis

After defining the basic configuration of turtle, we will determine the height of the frame and the size of the brush, as well as the corresponding frame title and the speed of the brush.

Screensize (800, 600, 'white') Pensize (3) Title (' SpongeBob squarepants ') Speed (19)Copy the code

First let’s adjust the brush position to find the corresponding origin position

def go_to(x, y):
    penup()
    goto(x, y)
    pendown()
​
go_to(0, 0)
Copy the code

Draw the head sponge of SpongeBob Squarepants, select the corresponding width, the coordinate size can adjust the positioning function can be reused, spongeBob squarepants is around the wavy line, add the corresponding radian, add yellow ~ hei hei

def head(): go_to(-200, 180) fillcolor('yellow') begin_fill() seth(-30) for _ in range(6): Circle (36, 60) circle(-36, 60) Seth (-125) for _ in range(5): circle(40,60) circle(-40,60) Seth (-210) for _ in range(4): Circle (45,60) circle(-45,60) for _ in range(5): circle(40,60) circle(-40,60)Copy the code

Spongebob’s body without anything.

Add facial expressions to SpongeBob squarepants. The data of the eyes are mostly circular, and the nose is small inverted hook, which can be adjusted by itself. Ps: Don’t be a spongeBob Squarepants, hahaha

def eye(): Go_to (14, -5) fillcolor('#f0f0f0') begin_fill() circle(65, 360) end_fill() begin_fill() go_to(13,12) Seth (98) circle(-65,360) end_fill() # eyeball go_to(-10,20) fillcolor('blue') Begin_fill () circle(20,360) end_fill() go_to(-22,20) fillcolor('black') begin_fill() circle(7,360) end_fill() Go_to (40 (9) fillcolor (' blue ') begin_fill () circle (20, 360) end_fill() go_to(53,15) fillcolor('black') begin_fill() circle(-7,360) end_fill() # lashes go_to(-95,65) left(20) Forward (40) go_to(-50,87) right(25) forward(32) go_to(0,70) right(25) forward(40) go_to(40, 40) 75) left(35) forward(40) go_to(90, 87) right(18) forward(30) go_to(120, 70) right(25) forward(40) def nose(): fillcolor('yellow') go_to(0, -7) begin_fill() right(50) circle(-60, 30) color('yellow') goto(15,-40) end_fill() color('black') go_to(0, -7) seth(-75) forward(30) go_to(30,-7) seth(-105) forward(30)Copy the code

This is SpongeBob squarepants with eyes

Add the top mouth and spongeBob’s typical big white teeth

def mouth():
    go_to(-120, - 60)
    seth(-45)
    circle(200, 30)
    seth(0)
    forward(100)
    seth(15)
    circle(200, 30)
​
def tooth():
    go_to(-30,-114)
    seth(-95)
    fillcolor('white')
    begin_fill()
    forward(30)
    seth(0)
    forward(40)
    seth(95)
    forward(30)
    go_to(-30,-114)
    end_fill()
​
    go_to(30, -114)
    seth(-95)
    fillcolor('white')
    begin_fill()
    forward(30)
    seth(0)
    forward(40)
    seth(95)
    forward(30)
    go_to(60, -114)
    end_fill()
​
Copy the code

This big front tooth is a bit like a rabbit, the parameters can also be adjusted, hehe

After the face was finished, he began to perfect some of the body structures and add the little white shirt and spongeBob’s arms.

def body(): go_to(-170,-180) seth(-120) circle(150, 30) seth(0) forward(40) seth(100) forward(35) seth(-80) forward(100) fillcolor('brown') begin_fill() seth(0) forward(300) seth(80) forward(110) seth(-100) forward(65) seth(180) forward(315) go_to(-118,-400) end_fill() go_to(-170,-255) fillcolor('yellow') begin_fill() seth(-75) forward(80) seth(0) forward(17) seth(105) forward(85) end_fill() go_to(200, -170) Seth (-60) circle(-150,30) Seth (-180) forward(45) begin_fill() Seth (0) forward(20) Seth (-100) forward(85) Seth (180)  forward(20) end_fill()Copy the code

Do you think you can, no, no, no, there is a very important point, that is its red red scarf.

The last step is to add spongeBob’s red scarf

def tie():
    go_to(-50,-225)
    seth(-40)
    forward(40)
    seth(30)
    forward(52)
    go_to(30,-225)
    seth(-30)
    forward(40)
    seth(40)
    forward(45)
    fillcolor('red')
    go_to(0, -240)
    begin_fill()
    seth(-60)
    forward(10)
    seth(0)
    forward(30)
    seth(60)
    forward(15)
    go_to(30,-225)
    end_fill()
    go_to(4,-250)
    begin_fill()
    seth(-100)
    forward(80)
    seth(0)
    forward(55)
    seth(100)
    forward(80)
    end_fill()
Copy the code

The boss can adjust the details. You like that? If you like it, you can give me a thumb