Draw Google Drive Logo Using Python

Draw Google Drive Logo Using Python

Introduction:

Hello and welcome to the copyassignment where we will learn how to Draw Google Drive Logo Using Python turtle. This could be very interesting for both beginners and experienced coders to learn. This could be simple and easy to understand because we have explained the code in simple terms.

Well, Google Drive is a platform where a free online storage service that allows users to store and access files. The service syncs documents, photos, and other data across all of the user’s devices, including mobile phones, tablets, and computers.

Step 1. Importing Libraries.

#import turtle library 
import turtle as t

Step 2: Set the background color and pen color

t.Screen().bgcolor("Black") #set the background color as black 
t.pencolor("White") #set pen color as white

Step 3: Make a blue-green and yellow box

#blue box
t.begin_fill() #fill the color
t.fillcolor('#4688F4')  #take a blue color hash or t.fillcolor(“blue”)  
t.forward(170) #move turtle forward at given pixel
t.left(60)   #move turtle 60 degree left 
t.forward(50)  #move 50 pixel forward
t.left(120)  #move turtle 120 degree left
t.forward(220) #move 50 pixel forward
t.left(120) #move turtle 120 degree left
t.forward(50) #move 50 pixel forward
t.end_fill() #end the fill color
#some changes to the steps in the blue box

#green box 
t.begin_fill() #fill the color
t.fillcolor('#1FA463') #take a green color hash or t.fillcolor(“green”)  
t.left(120)  #move turtle 120 degree left
t.forward(200)  #move 200 pixel forward
t.left(120)  #move turtle 120 degree left
t.forward(50) #move 50 pixel forward
t.left(60) #move turtle 60 degree left
t.forward(150) #move 150 pixel forward
t.left(60) #move turtle 60 degree left
t.forward(50) #move 50 pixel forward
t.end_fill() #end the fill color

Step 4: set the pen positions

t.penup()  #This method is used to stop the drawing pen
t.left(120) #move turtle 120 degree left
t.forward(200) #move 200 pixel forward

t.left(120) #move turtle 120 degree left
t.forward(50) #move 50 pixel forward
t.pendown() #Start drawing of the turtle pen
#After blue and green go for yellow box

#yellow box
t.begin_fill() #Start drawing of the turtle pen
t.fillcolor('#FFD048')  #take a yellow color hash or t.fillcolor(“yellow”)  
t.left(125) #move turtle 125 degree left
t.forward(160) #move 160 pixel forward
t.left(55) #move turtle 55 degree left
t.forward(53) #move 53 pixel forward
t.left(126) #move turtle 126 degree left
t.forward(163) #move 163 pixel forward
t.end_fill() #end the fill color
t.done() #now we complete the code with done function

Complete Code to Draw Google Drive Logo Using Python:

import turtle as t

t.hideturtle()
t.Screen().bgcolor("Black")
t.pencolor("white")
t.pensize(0)
#blue
t.begin_fill()
t.fillcolor('#4688F4')
t.forward(170)
t.left(60)
t.forward(50)
t.left(120)
t.forward(220)
t.left(120)
t.forward(50)
t.end_fill()

#green
t.begin_fill()
t.fillcolor('#1FA463')
t.left(120)
t.forward(200)
t.left(120)
t.forward(50)
t.left(60)
t.forward(150)
t.left(60)
t.forward(50)
t.end_fill()

t.penup()
t.left(120)
t.forward(200)
t.left(120)
t.forward(50)
t.pendown()


#yellow
t.begin_fill()
t.fillcolor('#FFD048')
t.left(125)
t.forward(160)
t.left(55)
t.forward(53)
t.left(126)
t.forward(163)
t.end_fill()
t.done()

Our code is complete, and we finally run it to see a Google Drive logo.

After running the code, it will open a new window and begin generating the Google Drive logo; after completed, the result should look like this.

Output

output for Draw Google Drive Logo Using Python

I hope you find it useful. You can make minor adjustments to the code to create an interesting logo.


Also Read:

Share:

Author: Ayush Purawr