Draw Python Logo In Python
Last updated July 3, 2023 by Jarvis Silva
Want to draw python logo in python programming, then you are at the right place today. In this python tutorial I will show you how to draw a python logo in python, so follow me till the end it will be interesting program.
I have created many tutorials on drawing things in python programming but today we will draw our favourite programming language python logo.
We will use turtle library to draw python logo, turtle is a graphics library which can be used to draw animations, characters, pictures etc.
Python Code To Draw Python Logo
import turtle
t = turtle.Turtle()
s = turtle.Screen()
s.bgcolor("black")
t.speed(10)
t.pensize(2)
t.pencolor("white")
def s_curve():
for i in range(90):
t.left(1)
t.forward(1)
def r_curve():
for i in range(90):
t.right(1)
t.forward(1)
def l_curve():
s_curve()
t.forward(80)
s_curve()
def l_curve1():
s_curve()
t.forward(90)
s_curve()
def half():
t.forward(50)
s_curve()
t.forward(90)
l_curve()
t.forward(40)
t.left(90)
t.forward(80)
t.right(90)
t.forward(10)
t.right(90)
t.forward(120) #on test
l_curve1()
t.forward(30)
t.left(90)
t.forward(50)
r_curve()
t.forward(40)
t.end_fill()
def get_pos():
t.penup()
t.forward(20)
t.right(90)
t.forward(10)
t.right(90)
t.pendown()
def eye():
t.penup()
t.right(90)
t.forward(160)
t.left(90)
t.forward(70)
t.pencolor("black")
t.dot(35)
def sec_dot():
t.left(90)
t.penup()
t.forward(310)
t.left(90)
t.forward(120)
t.pendown()
t.dot(35)
t.fillcolor("#306998")
t.begin_fill()
half()
t.end_fill()
get_pos()
t.fillcolor("#FFD43B")
t.begin_fill()
half()
t.end_fill()
eye()
sec_dot()
def pause():
t.speed(2)
for i in range(100):
t.left(90)
pause()
Above is the code for drawing the python logo. Now to run this program you need to have python installed on your computer, if you don’t have then follow this guide: Install and setup python on your computer. or else you can use this online python compiler.
We have used turtle library so might need to install mostly It comes installed with python setup but if you get any errors like turtle module is missing then use the below command to install the library.
pip install turtle
So now to run this program, open a command prompt or terminal at the project folder location and paste the below command
python filename.py
The above command will run this program and it will open a new window and start drawing the python logo, I hope you found this tutorial helpful and useful, do share this tutorial with your friends who might be interested in this program.
Here are some more python drawing tutorial for you:
- Draw pikachu using python with code.
- Draw doraemon using python turtle.
- Draw shinchan using python turtle.
- Draw I love you using python turtle.
- Draw Batman logo using python turtle.
- Draw Google Logo using python turtle.
- Make a python calculator using turtle.
- Draw christmas tree using python.
- Draw spiderman in python programming.
I hope you found what you were looking for from this tutorial, and if you want more python guides and tutorials like this, do join our Telegram channel for future updates.
Thanks for reading, have a nice day 🙂