Pythondex
Turtle Python Programs

Draw TikTok Logo Using Python

Last updated July 3, 2023 by Jarvis Silva

In this tutorial I will show you how to draw the TikTok logo using python turtle with code, TikTok is one of the most popular shorts video platform, You can post short videos with songs and filters and do many things on TikTok so today I have decided to create a tutorial on drawing its logo using python.

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

Python Code To Draw Tiktok Logo


from turtle import *

width(20)
bgcolor('black')
colors= ['#db0f3c', '#50ebe7','white']
pos = [(0,0), (-5,13), (-5,5)]

for (x,y),col in zip(pos,colors):
  up()
  goto(x,y)
  down()
  color(col)
  left(180)
  circle(50, 270)
  forward(120)
  left(180)
  circle(50, 90)

done()

Above is the python code to draw the TikTok logo, if you take a look at the code you will see all turtle functions let’s see how they work:

  • The code imports the entire turtle module, allowing access to its functions and classes.
  • The pen width is set to 20 pixels using width(20).
  • The background color is set to black using bgcolor('black').
  • A list of colors (colors) is defined, containing three elements: '#db0f3c', '#50ebe7', and 'white'.
  • Another list (pos) is defined, containing three coordinate pairs representing the positions to draw the circles of the logo.
  • A loop is used to iterate through the coordinate-color pairs using zip(pos, colors).
  • Inside the loop: a. The pen is lifted up using up(). b. The turtle’s position is set to the current coordinates using goto(x, y). c. The pen is lowered down using down(). d. The pen color is set to the current color using color(col). e. The turtle turns left by 180 degrees (left(180)). f. A semicircle with a radius of 50 pixels is drawn, spanning 270 degrees (circle(50, 270)). g. The turtle moves forward by 120 pixels (forward(120)). h. The turtle turns left by 180 degrees. i. Another semicircle with a radius of 50 pixels is drawn, spanning 90 degrees.
  • The done() function is called to finish the drawing and keep the turtle graphics window open until manually closed.

Now you have the code, but there is one last thing you need to do as I have said I have used the turtle library for this program so you might need to install it if you get any errors like turtle module not found so use below command to install.


pip install turtle

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

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

Tiktok Logo Drawing

As you can see, we successfully drew the TikTok logo using python turtle. 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 🙂