Introduction
Hello and welcome to violet-cat-415996.hostingersite.com. Many of us have watched the Shaktiman series which used to come on the Doordarshan channel. The kids and young children feel fantasized about the superhero Shaktiman and his dress. So in our today’s article, we are drawing the Shaktiman Logo using the Python Turtle module. We have used very simple lines of code that are easily understandable to all the beginners learning python.
The code contains comments so that each line of the code contains proper documentation and avoids confusion.
For the entire code with output, you can go to the bottom of the page and copy the code.
Let’s starts
Import turtle
import turtle
First, we will import the python turtle module to access inbuilt methods and functions.
function to draw the shape of a Circle
turtle.bgcolor("red")#background color is set to red #function defined to pass the radius def drawshape(turtle,radius): turtle.circle(radius,extent=60)# initialize the radius of circle and the angle turtle.left(120) turtle.circle(radius,extent=60)
In this part, we have the function defined drawshape where we have initialized the turtle and the radius of the circle. The circle is passed with a radius and an angle of 60 degrees upon calling the function.
Create a function to set the attributes for creating the flower
def drawflower(): petal=turtle.Turtle() petal.color("yellow") petal.speed(0) petal.pensize(4) no_of_petals=15 radius=145 petal.begin_fill() for i in range(no_of_petals): drawshape(petal,radius) petal.left(360 /no_of_petals ) petal.end_fill() drawflower()
In this piece of code, we have created the function of drawflower. Here we have initialized the color, speed, pensize, number of petals, and radius of the flower. We have created another for loop where the loop will iterate 15 times. In the for loop, we are calling the drawshape function. The angle of the petal.left(24) is set for each circle i.e( petal.left(360/no_of_petals). The flower is filled with a yellow color that is created by the function drawflower.
Draw a round red circle
#draw the main round circle of Shaktiman Logo turtle.pensize(4) turtle.color("yellow","red") turtle.goto(0,-94) turtle.pendown() turtle.begin_fill() turtle.circle(95) turtle.end_fill()
In this part, we have drawn the round red circle above the flower shape. The radius is 95, and the position here is goto(0,-94).
Draw the first Triangle
#draw the first triangle turtle.color("yellow") turtle.begin_fill() turtle.left(60) turtle.forward(160) turtle.left(120) turtle.forward(160) turtle.left(120) turtle.forward(160) turtle.end_fill()
We have drawn a simple triangle will pen color yellow with a forward(160) function to forward 160 steps and kept the angle of left 60 and left 120 degrees.
Draw the Second Triangle
#draw the second Triangle turtle.penup() turtle.color("red") turtle.goto(-0,-70) turtle.pendown() turtle.begin_fill() turtle.left(120) turtle.forward(120) turtle.left(120) turtle.forward(120) turtle.left(120) turtle.forward(120) turtle.end_fill() turtle.penup()
In this part of the code, we have drawn the second inner triangle. It has the same function except the color is set to red. The position of the turtle is set to goto(-0,-70).
Draw the third and fourth triangle of the Shaktiman Logo using Python Turtle
#Draw the third triangle turtle.color("yellow","yellow") turtle.goto(80,-43) turtle.pendown() turtle.setheading(0) turtle.left(120) turtle.forward(160) turtle.setheading(270) turtle.right(30) turtle.forward(160) turtle.setheading(0) turtle.forward(160) #draw the fourth traingle turtle.begin_fill() turtle.backward(15) turtle.left(90) turtle.forward(10) turtle.left(30) turtle.forward(135) turtle.right(30) turtle.forward(13) turtle.end_fill() turtle.begin_fill() turtle.backward(15) turtle.left(150) turtle.forward(138) turtle.right(25) turtle.forward(15) turtle.end_fill() turtle.pensize(9) turtle.backward(10) turtle.setheading(0) turtle.forward(138) turtle.penup()
Here, we have drawn the third and fourth triangles. For the third triangle, we have set the position to goto(80,-43). The set heading function directly points in the direction of 0 degrees i.e east and 270 degrees i.e south respectively.
Similar way, we have drawn the fourth triangle by setting the position and the turtle functions.
Draw the S Letter of Shaktiman Logo using Python Turtle
#draw the s letter of shaktiman turtle.pensize(2) turtle.goto(-28,-25) turtle.pendown() turtle.left(20) turtle.begin_fill() turtle.forward(10) turtle.left(40) turtle.forward(55) turtle.right(30) turtle.forward(20) turtle.right(100) turtle.forward(10) turtle.right(80) turtle.forward(15) turtle.left(30) turtle.forward(55) turtle.right(27) turtle.forward(20) turtle.end_fill()
Here we have kept the size of the pen 2 and set the position to goto(-28,-25). From this location, we start to draw the S letter of the Shaktiman Logo. After completion filled with yellow color by using begin_fill and end_fill() functions.
Complete Code to Draw the Shaktiman Logo using Python Turtle
import turtle turtle.bgcolor("red") def drawshape(turtle,radius): turtle.circle(radius,extent=60) turtle.left(120) turtle.circle(radius,extent=60) def drawflower(): petal=turtle.Turtle() petal.color("yellow") petal.speed(0) petal.pensize(4) no_of_petals=15 radius=145 petal.begin_fill() for i in range(no_of_petals): drawshape(petal,radius) petal.left(360 /no_of_petals ) petal.end_fill() drawflower() #draw the main round circle of Shaktiman Logo turtle.pensize(4) turtle.color("yellow","red") turtle.goto(0,-94) turtle.pendown() turtle.begin_fill() turtle.circle(95) turtle.end_fill() #draw the first triangle turtle.color("yellow") turtle.begin_fill() turtle.left(60) turtle.forward(160) turtle.left(120) turtle.forward(160) turtle.left(120) turtle.forward(160) turtle.end_fill() #draw the second Triangle turtle.penup() turtle.color("red") turtle.goto(-0,-70) turtle.pendown() turtle.begin_fill() turtle.left(120) turtle.forward(120) turtle.left(120) turtle.forward(120) turtle.left(120) turtle.forward(120) turtle.end_fill() turtle.penup() #Draw the third triangle turtle.color("yellow","yellow") turtle.goto(80,-43) turtle.pendown() turtle.setheading(0) turtle.left(120) turtle.forward(160) turtle.setheading(270) turtle.right(30) turtle.forward(160) turtle.setheading(0) turtle.forward(160) #draw the fourth triangle turtle.begin_fill() turtle.backward(15) turtle.left(90) turtle.forward(10) turtle.left(30) turtle.forward(135) turtle.right(30) turtle.forward(13) turtle.end_fill() turtle.begin_fill() turtle.backward(15) turtle.left(150) turtle.forward(138) turtle.right(25) turtle.forward(15) turtle.end_fill() turtle.pensize(9) turtle.backward(10) turtle.setheading(0) turtle.forward(138) turtle.penup() #draw the s letter of shaktiman turtle.pensize(2) turtle.goto(-28,-25) turtle.pendown() turtle.left(20) turtle.begin_fill() turtle.forward(10) turtle.left(40) turtle.forward(55) turtle.right(30) turtle.forward(20) turtle.right(100) turtle.forward(10) turtle.right(80) turtle.forward(15) turtle.left(30) turtle.forward(55) turtle.right(27) turtle.forward(20) turtle.end_fill() turtle.hideturtle() turtle.done()
Output
Here we have successfully completed drawing the Shaktiman Logo using the Python Turtle module. Please leave your comments in the comment box.
Thank you for reading this article.
Also Read:
- Imagination to Reality, Unlocking the Future: Genesis Physics Engine for 4D Simulation
- Simple Code to compare Speed of Python, Java, and C++?
- Falling Stars Animation on Python.Hub October 2024
- Most Underrated Database Trick | Life-Saving SQL Command
- Python List Methods
- Top 5 Free HTML Resume Templates in 2024 | With Source Code
- How to See Connected Wi-Fi Passwords in Windows?
- 2023 Merry Christmas using Python Turtle
- 23 AI Tools You Won’t Believe are Free
- Python 3.12.1 is Now Available
- Best Deepfake Apps and Websites You Can Try for Fun
- Amazon launched free Prompt Engineering course: Enroll Now
- 10 GitHub Repositories to Master Machine Learning
- Hello World in 35 Programming Languages
- How to Scrape Data From Any Website with Python?
- Become Job Ready With Free Harvard Computer Science course: Enroll Now
- Free Python Certification course from Alison: Good for Resume
- Download 1000+ Projects, All B.Tech & Programming Notes, Job, Resume & Interview Guide, and More – Get Your Ultimate Programming Bundle!
- Udacity Giving Free Python Course: Here is how to Enroll
- Love Babbar’s Income Revealed
- Top 5 Websites to Learn Programming in 2024
- Python Internship for college students and freshers: Apply Here
- Microsoft Giving Free Python Course in 2023: Enroll Now
- Top 5 Free Python Courses on YouTube in 2024
- Complete Python Roadmap for Beginners in 2024
- New secrets to Earn money with Python in 2024
- Connect with HR Directly – Job Hack
- Google offering free Python course: Enroll Today
- What is an AI Tool?
- Google Internship 2024