
Introduction
In this article, we’ll look at how to draw an Android Logo using Python Turtle module. Install the turtle python package to create the Android logo. We can create any type of graph using the turtle module. See the complete code for the Android logo below.
Let’s Code!
Step 1. First of all import the libraries to draw the logo
import turtle as t
Turtle is a python library, it is used to draw shapes.
Step 2. Setup the Background and Pen Location
t.bgcolor("gray")
t.penup()
t.goto(-80,80)
t.pendown()
t.pencolor("#3DDC84")
here penup() function will lift the turtle off the digital canvas, the goto function is used to move the cursor to the desired location, and pendown() is mostly useful to reestablish pendown state after using .penup(). Pencolor() function is used to set the pen color
Step 3. Creating a function to draw circles
def circle():
t.begin_fill()
t.fillcolor('white')
t.circle(7)
t.end_fill()
Creating a circle() is used to draw the circles for the eyes. begin_fill() function is used to fill the color in particular shapes. and to choose and fill the color we use fill_color().
Step 4. Drawing the Upper Body of Android Logo.
def draw_upperbody():
t.begin_fill()
t.fillcolor("#3DDC84")
t.forward(150)
t.left(90)
for i in range(238):
t.left(0.76)
t.forward(1)
t.end_fill()
#drawing eyes
#left Eye
t.penup()
t.goto(-46,120)
t.pendown()
circle()
#Right Eye
t.penup()
t.goto(24,120)
t.pendown()
circle()
#Drawing ears
#left ear
t.penup()
t.goto(-40,140)
t.pendown()
t.pensize(4)
t.right(140)
t.forward(50)
#Right ear
t.penup()
t.goto(34,144)
t.pendown()
t.pensize(4)
t.right(80)
t.forward(46)
This function is responsible for creating an android body. in this function, the code is pretty easy to understand. we put one for a loop. And use some by default functions to draw the body
Step 5. Draw the Middle body of the Android logo.
def draw_middlebody():
t.begin_fill()
t.fillcolor("#3DDC84")
t.pensize(1)
t.right(141)
t.forward(100)
for i in range(20):
t.forward(1)
t.left(5)
t.right(9.5)
t.forward(127)
for i in range(20):
t.forward(1)
t.left(5)
t.right(9.5)
t.forward(100)
t.end_fill()
To draw the middle body, We use two for loops first forward(127) right(9.5) and in the second loop we take forward(100) right(9.5) then fill the color “end_fill”.
Step 6. Drawing the hands of Android Logo.
#hand
def draw_hand():
t.begin_fill()
t.fillcolor("#3DDC84")
for i in range(45):
t.right(4)
t.forward(1)
t.forward(70)
for i in range(45):
t.right(4)
t.forward(1)
t.forward(70)
t.end_fill()
This function is used to construct both the left and right hands of the Android logo.
Step 7. Draw the lower body of the Android.
#legs
def draw_legs():
t.begin_fill()
t.fillcolor("#3DDC84")
t.right(91)
t.forward(30)
t.right(90)
t.forward(50)
for i in range(45):
t.right(4)
t.forward(1)
t.end_fill()
This code is responsible for creating both the left and right legs of the Android Logo.
Complete code to draw Android Logo using Python Turtle
import turtle as t t.bgcolor("white") t.penup() t.goto(-80,80) t.pendown() t.speed(8) t.pencolor("#3DDC84") def circle(): t.begin_fill() t.fillcolor('white') t.circle(7) t.end_fill() #Drawing the Head def draw_upperbody(): t.begin_fill() t.fillcolor("#3DDC84") t.forward(150) t.left(90) for i in range(238): t.left(0.76) t.forward(1) t.end_fill() #drawing eyes #left Eye t.penup() t.goto(-46,120) t.pendown() circle() #Right Eye t.penup() t.goto(24,120) t.pendown() circle() #Drawing ears #left ear t.penup() t.goto(-40,140) t.pendown() t.pensize(4) t.right(140) t.forward(50) #Right ear t.penup() t.goto(34,144) t.pendown() t.pensize(4) t.right(80) t.forward(46) #Drawing the middle body def draw_middlebody(): t.begin_fill() t.fillcolor("#3DDC84") t.pensize(1) t.right(141) t.forward(100) for i in range(20): t.forward(1) t.left(5) t.right(9.5) t.forward(127) for i in range(20): t.forward(1) t.left(5) t.right(9.5) t.forward(100) t.end_fill() #hand def draw_hand(): t.begin_fill() t.fillcolor("#3DDC84") for i in range(45): t.right(4) t.forward(1) t.forward(70) for i in range(45): t.right(4) t.forward(1) t.forward(70) t.end_fill() #legs def draw_legs(): t.begin_fill() t.fillcolor("#3DDC84") t.right(91) t.forward(30) t.right(90) t.forward(50) for i in range(45): t.right(4) t.forward(1) t.end_fill() draw_upperbody() t.penup() t.goto(-80,68) t.pendown() draw_middlebody() t.penup() t.goto(80,68) t.pendown() draw_hand() t.penup() t.goto(-124,70) t.pendown() draw_hand() t.penup() t.goto(-50,-50) t.pendown() draw_legs() t.penup() t.goto(14,-50) t.pendown() t.left(1.7) draw_legs() t.hideturtle() t.done()
Output:

Thank you for reading the article. Visit our home page for more articles like this.
Also Read:
- Unveiling the Future of AI Detector
- CodeWithHarry Earns 20 Lakhs per month from YouTube?
- Cleaning Service Booking System in Python Tkinter
- Farmers Ecommerce App using Python Tkinter
- Guidelines for Project Collaboration Process
- The system of the binary conversion
- What is web development for beginners?
- Guide to Proxy Servers: How They Work and Why You Need Them?
- Python | Check Armstrong Number using for loop
- Python | Factorial of a number using for loop
- Link in bio
- Microsoft Giving Free Machine Learning Course: Enroll Now
- Accenture Giving Free Developer Certificate in 2023
- Python | Asking the user for input until they give a valid response
- Python | How to iterate through two lists in parallel?
- Amazon Summer Internship 2023
- Python | How to sort a dictionary by value?
- Amazon Giving Free Machine Learning Course with Certificate: Enroll Now
- Google Summer Internship 2023
- Python | How to split a list into equally-sized chunks?
- 5 Secret ChatGPT skills to make money
- Python | Remove items from a list while iterating
- Free Google Certification Courses
- 5 AI tools for coders better than ChatGPT
- Python | How to get dictionary keys as a list
- New secrets to Earn money with Python in 2023
- Flower classification using CNN
- How to represent Enum in Python?
- 5 methods | Flatten a list of lists | Convert nested list into a single list in Python
- What does if __name__ == __main__ do in Python?