Draw a Spiderman logo using Python Turtle

Draw a Spiderman logo using Python Turtle

Introduction

Welcome friends to copyassignment.com.You all might have watched the movie of Spiderman, most of us are well aware of the dress of spiderman and quite enthusiastic about it. You all know the logo that is present on the spiderman dress. So today we are going to draw the logo of spiderman with the help of using the python turtle module.

The code we are going to write is straightforward with simple turtle functions which are easy to understand. We are also providing the explanation of the code and the comments wherever necessary so the program becomes easy to understand even for the beginner.

If you want more articles like this on the python turtle module, visit our website for the different projects.

For the detailed code, go to the bottom of the page and you will get the code along with the output for your reference.

Let’s begin

Import function

import turtle

Importing the turtle module allows us to use its inbuilt methods and functions in our program.

Setting the turtle object

#Set the turtle object
t=turtle.Turtle()
scr=turtle.Screen()
scr.bgcolor("red")

In this part of code the turtle object is created as t and the screen object as scr. The background color is set to red.

Draw the head of the spiderman logo

#draw the head
t.goto(0,0)
t.begin_fill()
t.circle(20)
t.end_fill()

Here we have set the turtle in the center at goto(0,0) and drawn the head of spiderman with a circle radius  20. The head is filled with the default color i.e black.

Draw the body of the spiderman logo

t.penup()
t.setheading(270)
t.left(60)
t.pendown()
t.begin_fill()
t.forward(20)
t.right(80)
t.forward(70)
t.right(147)
t.forward(70)
t.right(80)
t.forward(20)
t.penup()
t.end_fill()

In this part of the code, we have drawn the body of spiderman setting the head position to 270 degrees. The forward method to set the steps to move forward and the right method to change the angle position are used to draw the body of spiderman here.

Draw the upper right legs of the spiderman logo

#right 1 upper legs
t.pendown()
t.goto(10,35)
t.pendown()
t.begin_fill()
t.left(20)
t.forward(25)
t.right(60)
t.forward(50)
t.left(120)
t.forward(80)
t.right(175)
t.forward(95)
t.right(127)
t.forward(63)
t.left(60)
t.forward(18)
t.end_fill()

#right 2 upper legs
t.pendown()
t.goto(13,25)
t.pendown()
t.begin_fill()
t.left(90)
t.left(90)
t.forward(20)
t.right(60)
t.forward(80)
t.left(125)
t.forward(130)
t.right(175)
t.forward(145)
t.right(128)
t.forward(95)
t.left(60)
t.forward(20)
t.end_fill()
t.penup()

In this piece of code, we have drawn 2 upper right legs. In the first, right first upper leg we have set the turtle to position to goto(10,35).set the default color to black. The turtle is moved forward to draw the leg according to the specified coordinates and angles.

Similar is the case for the right second upper leg of the spiderman and the starting position of the second leg is set to goto(13,25) and the rest is the same functioning as the right first upper leg.

Draw the upper left legs of the spiderman logo

#left 1 upper leg
t.pendown()
t.goto(-10,35)
t.pendown()
t.begin_fill()
t.right(80)
t.forward(25)
t.left(60)
t.forward(50)
t.right(120)
t.forward(80)
t.left(175)
t.forward(95)
t.left(127)
t.forward(63)
t.right(60)
t.forward(18)
t.end_fill()

#2 left upper leg

t.pendown()
t.goto(-13,25)
t.pendown()
t.begin_fill()
t.right(90)
t.right(90)
t.forward(20)
t.left(60)
t.forward(80)
t.right(125)
t.forward(130)
t.left(175)
t.forward(145)
t.left(128)
t.forward(95)
t.right(60)
t.forward(20)
t.end_fill()
t.penup

In this part of the code, we have drawn 2 upper left legs.In the beginning, left first upper leg we have set the turtle to position to goto(-10,35).set the default color to black. The turtle is moved forward to draw the leg according to the specified coordinates and angles as mentioned in the code.

Similar is the case for the left second upper leg of the spiderman and the starting position of the second leg is set to goto(-13,25) and the rest is the same functioning as the left first upper leg.

Draw the right 2 lower legs of the spiderman logo

#right lower 1 leg of spider
t.pendown()
t.goto(15,12)
t.left(60)
t.begin_fill()
t.forward(20)
t.right(40)
t.forward(95)
t.right(100)
t.forward(135)
t.right(175)
t.forward(120)
t.left(90)
t.forward(80)
t.left(40)
t.forward(20)
t.end_fill()

#right lower 2 leg of the spider
t.pendown()
t.goto(11,8)
t.left(150)
t.begin_fill()
t.forward(25)
t.right(10)
t.forward(65)
t.right(95)
t.forward(70)
t.right(175)
t.forward(60)
t.left(85)
t.forward(65)
t.left(15)
t.forward(15)
t.end_fill()

In this block of code, we have drawn 2 lower right legs.In the beginning, right 1 lower leg we have set the turtle to position to goto(15,20).set the default color to black. The turtle is moved forward to draw the leg according to the specified coordinates and angles as mentioned in the code.

Similar is the case for the right second lower leg of the spiderman and the starting position of the second leg is set to goto(11,8) and the rest is the same as functioning as the right first lower leg.

Draw the left 2 lower legs of the spiderman logo

#left lower 1st leg of the spider
t.pendown()
t.goto(-15,14)
t.right(3)
t.begin_fill()
t.forward(20)
t.left(40)
t.forward(95)
t.left(100)
t.forward(135)
t.left(175)
t.forward(120)
t.right(90)
t.forward(80)
t.right(40)
t.forward(20)
t.end_fill()
t.penup()

#left lower 2nd leg of the spider
t.pendown()
t.goto(-11,8)
t.right(90)
t.right(60)
t.begin_fill()
t.forward(25)
t.left(10)
t.forward(65)
t.left(95)
t.forward(70)
t.left(175)
t.forward(60)
t.right(85)
t.forward(65)
t.right(15)
t.forward(15)
t.end_fill()

t.hideturtle()

In this block of code, we have drawn 2 lower left legs. In the initial stage, left first lower leg we have set the turtle to position to goto(-15,14).set the default color to black. The turtle is moved forward to draw the leg according to the specified coordinates and angles as mentioned in the code.

Similar is the case for the left second lower leg of spiderman and the starting position of the second leg is set to goto(-11,8) and the rest is the same as functioning as the left first lower leg.

At last, the turtle is hidden to give the proper output.

Complete Code to draw spiderman logo using python turtle

#Import the turtle
import turtle

#Set the turtle object
t=turtle.Turtle()
scr=turtle.Screen()
scr.bgcolor("red")

#draw the head
t.goto(0,0)
t.begin_fill()
t.circle(20)
t.end_fill()

#draw the body
t.penup()
t.setheading(270)
t.left(60)
t.pendown()
t.begin_fill()
t.forward(20)
t.right(80)
t.forward(70)
t.right(147)
t.forward(70)
t.right(80)
t.forward(20)
t.penup()
t.end_fill()

# right upper first upper leg
t.pendown()
t.goto(10,35)
t.pendown()
t.begin_fill()
t.left(20)
t.forward(25)
t.right(60)
t.forward(50)
t.left(120)
t.forward(80)
t.right(175)
t.forward(95)
t.right(127)
t.forward(63)
t.left(60)
t.forward(18)
t.end_fill()

# right upper second leg

t.pendown()
t.goto(13,25)
t.pendown()
t.begin_fill()
t.left(90)
t.left(90)
t.forward(20)
t.right(60)
t.forward(80)
t.left(125)
t.forward(130)
t.right(175)
t.forward(145)
t.right(128)
t.forward(95)
t.left(60)
t.forward(20)
t.end_fill()
t.penup()

#left first upper leg of the spider
t.pendown()
t.goto(-10,35)
t.pendown()
t.begin_fill()
t.right(80)
t.forward(25)
t.left(60)
t.forward(50)
t.right(120)
t.forward(80)
t.left(175)
t.forward(95)
t.left(127)
t.forward(63)
t.right(60)
t.forward(18)
t.end_fill()

#left second upper leg of the spider
t.pendown()
t.goto(-13,25)
t.pendown()
t.begin_fill()
t.right(90)
t.right(90)
t.forward(20)
t.left(60)
t.forward(80)
t.right(125)
t.forward(130)
t.left(175)
t.forward(145)
t.left(128)
t.forward(95)
t.right(60)
t.forward(20)
t.end_fill()
t.penup

#right first lower leg of spider
t.pendown()
t.goto(15,12)
t.left(60)
t.begin_fill()
t.forward(20)
t.right(40)
t.forward(95)
t.right(100)
t.forward(135)
t.right(175)
t.forward(120)
t.left(90)
t.forward(80)
t.left(40)
t.forward(20)
t.end_fill()

#right second lower leg of the spider
t.pendown()
t.goto(11,8)
t.left(150)
t.begin_fill()
t.forward(25)
t.right(10)
t.forward(65)
t.right(95)
t.forward(70)
t.right(175)
t.forward(60)
t.left(85)
t.forward(65)
t.left(15)
t.forward(15)
t.end_fill()

#left lower first leg of the spider
t.pendown()
t.goto(-15,14)
t.right(3)
t.begin_fill()
t.forward(20)
t.left(40)
t.forward(95)
t.left(100)
t.forward(135)
t.left(175)
t.forward(120)
t.right(90)
t.forward(80)
t.right(40)
t.forward(20)
t.end_fill()
t.penup()

#left lower second leg of the spider
t.pendown()
t.goto(-11,8)
t.right(90)
t.right(60)
t.begin_fill()
t.forward(25)
t.left(10)
t.forward(65)
t.left(95)
t.forward(70)
t.left(175)
t.forward(60)
t.right(85)
t.forward(65)
t.right(15)
t.forward(15)
t.end_fill()

t.hideturtle()
turtle.done()

Output

output to spiderman logo using python turtle

Keep visiting the website for more articles on different python topics.

Thank you for reading this article.


Also Read:

Share:

Author: Ayush Purawr