Draw Chrome Logo Using Python Turtle
Last updated July 3, 2023 by Jarvis Silva
In this tutorial we will see how to draw chrome logo with turtle in python, chrome is a browser by Google, drawing its logo in python is going to be very interesting.
To create this program using python, we will use the turtle module, It is a GUI library with which you can draw anything.
Python Code To Draw Chrome Logo
from turtle import *
from time import sleep
colormode(255)
red=(223, 35, 35); green=(75, 183, 75); yellow=(252, 216, 9);
blue=(86, 146, 195)
r=120
seth(-150)
up()
#-------------RED -------------
color(red)
begin_fill()
fd(r)
down()
right(90)
circle(-r, 120)
fd(r*3**.5)
left(120)
circle(2*r, 120)
left(60)
fd(r*3**.5)
end_fill()
#-------------Green -------------
left(180)
color(green)
begin_fill()
fd(r*3**.5)
left(120)
circle(2*r, 120)
left(60)
fd(r*3**.5)
left(180)
circle(-r, 120)
end_fill()
#-------------Yellow -------------
left(180)
circle(r,120)
color(yellow)
begin_fill()
circle(r, 120)
right(180)
fd(r*3**.5)
right(60)
circle(-2*r, 120)
right(120)
fd(r*3**.5)
end_fill()
#-------------Blue Circle-------------
up()
left(98)
fd(r/20)
seth(60)
color(blue)
down()
begin_fill()
circle(distance(0,0))
end_fill()
ht()
done()
Above is the python code for drawing the chrome logo, the whole program is made using turtle let’s see how it works:
- The code imports the Turtle module, which allows for graphics and drawing on a canvas.
- It sets the color mode to RGB (red, green, blue) with a range of 0-255.
- The turtle’s initial position and heading are set, and the pen is lifted up.
- The code draws a red shape using the Turtle’s forward movement, turning, and circle-drawing functions.
- Then, it draws a green shape by changing the turtle’s heading and color.
- Next, a yellow shape is drawn by changing the turtle’s heading and color again.
- Finally, a blue circle is drawn by positioning the turtle, setting the color, and using the circle-drawing function.
You don’t have to install the turtle library because it comes preinstalled with python but If you get any errors saying turtle module is not found then use the below command to install
pip install turtle
You can run the program on your computer or you can use an online python compiler.
After running, it will open a new window and start drawing the chrome logo and below is the finished drawing output of this program.
As you can see we have successfully drawn the chrome logo using python and this was possible because of the turtle module.
Here are more python turtle tutorials for you:
- 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 python tutorial. If you want more python tutorials like this, then do join our Telegram channel for future updates.
Thanks for reading, have a nice day 🙂