Explore

Python Turtle Programs

Draw Facebook Logo Using Python

Want to know how to draw Facebook logo using python, then you are at the right place. Today in this tutorial we will see how to create this program in python step by step.

Facebook is one of the most popular Social Media platform, You can post, find friends and do many things on Facebook so I have decided to create a tutorial on drawing its logo using python.

We will use the turtle module for creating this python program, Turtle is a GUI library with the help of this library you can draw anything in python. 

Python Code To Draw Facebook Logo


from turtle import *

speed(10)
color("#0270d6")

Screen().bgcolor('yellow')

penup()
goto(0, 150)
pendown()

begin_fill()
forward(150)
circle(-50, 90)
forward(300)
circle(-50, 90)
forward(300)
circle(-50, 90)
forward(300)
circle(-50, 90)
forward(150)
end_fill()

color("white")
penup()
goto(140, 80)
pendown()

begin_fill()
right(180)
forward(50)
circle(80, 90)
forward(50)
right(90)
forward(80)
left(90)
forward(40)
left(90)
forward(80)
right(90)
forward(160)
left(90)
forward(55)
left(90)
forward(160)
right(90)
forward(70)
left(80)
forward(45)
left(100)
forward(80)
right(90)
forward(40)
circle(-40, 90)
forward(40)
left(90)
forward(45)
end_fill()

hideturtle()
done()

Above is the python code for drawing the Facebook logo, the code is entirely created using the turtle functions so let’s how they work:

  • The code imports the Turtle module from the turtle library and renames it as ‘t’.
  • The turtle’s pen color and fill color are set to red using the pencolor() and fillcolor() functions.
  • The turtle begins filling a shape using the begin_fill() function.
  • The turtle’s pen is lifted off the drawing surface using the penup() function, and it moves to the coordinates (150, 100) using the goto() function.
  • The turtle turns 180 degrees to face the opposite direction and then turns 3 degrees to the right using the left() and right() functions.
  • The pen is lowered onto the drawing surface using the pendown() function.
  • The turtle’s screen background color is set to yellow using the bgcolor() function.
  • A loop is executed 10 times, where the turtle moves forward by 30 units and turns 0.5 degrees to the left each time, creating a spiral-like shape.
  • Multiple loops are used to draw intricate patterns by moving the turtle forward and turning it at different angles.
  • Finally, the turtle ends the fill, changes the pen color to white, and draws a triangular shape using the forward() and left() functions. The turtle then fills the triangle with white color and ends the fill. The turtle’s position and orientation are manipulated to create the desired shape. The drawing is completed by calling done(), which closes the turtle graphics window.

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 compute or else you can use this online python compiler.

When you run the program it will open a new window and it will start drawing the Facebook Logo and below is the finished drawing of the logo.

Facebook Logo Drawing

As you can see, we successfully drew the exact Facebook logo, I hope you were able to run this program successfully. 

Want more amazing turtle tutorials like this check out this: Awesome Python Turtle Codes.

Here are some more python drawing tutorials for you:

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 🙂