Explore

Close
Turtle Programs Share

Draw Ganpati In Python Turtle With Code

Draw Ganpati In Python Turtle With Code

Want to draw ganpati in python programming then you are at the right place today in this tutorial I will show you how to draw ganpati using python. It is going to be an amazing program, so read till the end.

Ganpati is the hindu god which is also known as lord ganesha. I will show you how to draw lord ganesha using python. You don’t have to worry about anything, I will provide you with the python code to draw ganpati.

To draw ganesha in python we will use the turtle module which is a GUI library which you can use to draw things in python. Now let’s see how to draw ganpati in python code.

Python Code To Draw Ganpati


#imports
import turtle as t
#variables
screen = t.Screen()
ganpati = t.Turtle()
blue = '#10557d'
white = '#ffffff'
red = '#ff0004'
black = '#000000'
yellow = '#ffb700'

screen.title('Ganpati Drawing')
ganpati.shape('turtle')

# pentagon
ganpati.color(blue, blue)
ganpati.begin_fill()
ganpati.left(angle=130)
ganpati.forward(distance=55)
ganpati.right(90)
ganpati.forward(70)
ganpati.right(65)
ganpati.forward(70)
ganpati.right(80)
ganpati.forward(55)
ganpati.right(70)
ganpati.forward(66)
ganpati.end_fill()

ganpati.penup()
ganpati.forward(10)
ganpati.left(90)
ganpati.forward(12.5)
ganpati.pendown()

#square
ganpati.color(yellow, yellow)
ganpati.begin_fill()
ganpati.forward(90)
for _ in range(3):
    ganpati.left(90)
    ganpati.forward(90)
ganpati.end_fill()

ganpati.penup()
ganpati.forward(10)
ganpati.pendown()

#rectangle 1
ganpati.color(red, red)
ganpati.begin_fill()
for _ in range(2):
    ganpati.forward(27.5)
    ganpati.right(90)
    ganpati.backward(90)
    ganpati.right(90)

ganpati.penup()
ganpati.right(180)
ganpati.forward(137.5)
ganpati.pendown()

#rectangle 2
for _ in range(2):
    ganpati.backward(27.5)
    ganpati.right(90)
    ganpati.forward(90)
    ganpati.right(90)
ganpati.end_fill()

ganpati.penup()
ganpati.left(180)
ganpati.forward(57.5)
ganpati.left(90)
ganpati.forward(5)
ganpati.left(90)
ganpati.pendown()

# Bindi line 1
ganpati.color(white)
ganpati.backward(50)

ganpati.penup()
ganpati.right(90)
ganpati.forward(5)
ganpati.left(90)
ganpati.pendown()

#Bindi line 2
ganpati.forward(50)

ganpati.penup()
ganpati.right(90)
ganpati.forward(5)
ganpati.left(90)
ganpati.pendown()

#Bindi line 3
ganpati.backward(50)

ganpati.penup()
ganpati.right(90)
ganpati.forward(10)
ganpati.pendown()

#Eye 1
ganpati.color(black, black)
ganpati.begin_fill()
ganpati.circle(5)

ganpati.penup()
ganpati.left(90)
ganpati.forward(50)
ganpati.pendown()

#Eye 2
ganpati.circle(5)
ganpati.end_fill()

ganpati.penup()
ganpati.right(180)
ganpati.forward(30)
ganpati.left(90)
ganpati.forward(25)
ganpati.pendown()

#Nose
ganpati.color(red, red)
ganpati.begin_fill()
ganpati.forward(100)
ganpati.left(90)
ganpati.forward(50)
ganpati.left(90)
ganpati.forward(20)
ganpati.left(90)
ganpati.forward(30)
ganpati.right(90)
ganpati.forward(80)
ganpati.end_fill()

# finisher
ganpati.penup()
ganpati.forward(1000)

screen.mainloop()

Above is the full code to draw ganpati in python. First create a new folder for this project, open it in a code editor, create a python file and paste the above python code.

As I have said I used the turtle module, if you have python setted on your computer you don’t have to install the turtle library because it comes installed with python.

But if you don’t have python installed or you get an error like this turtle module not found, then you can use the below command to install turtle library.


pip install turtle

The above command will install the turtle library in your project. Now you can run the program on your computer or you can use an online python compiler.

To run the program on your computer, Open a command prompt or terminal at the project folder location and paste the below command to run.


python filename.py

The above command will run the program. It will open a new window and start drawing ganpati and below is the finished drawing output.

Python Ganpati Output

As you can see we have drawn ganpati using python. I know it is not exactly like a real ganpati.

Above is a YouTube tutorial on drawing ganpati in python. This program was done with the help of this tutorial.

Summary

This was the tutorial on drawing ganpati in python programming. I hope you found this tutorial helpful and useful. Do share this article with your friends who might be interested in this program.

Here are some more python drawing tutorials:

I hope you found what you were looking for from this tutorial and if you want more python tutorials like this then do join our Telegram channel for future updates.

Thanks for reading, have a nice day 🙂