Pythondex
Turtle Python Programs

Draw Triangle In Python Using Turtle Module

Last updated July 3, 2023 by Jarvis Silva

In this tutorial we will see how to draw a triangle in python turtle, turtle module is a GUI python library which can be used to draw anything from characters, cartoons, shapes and other objects.

Python Code To Draw Triangle


import turtle as t

t.bgcolor("#eeeeee")
t.fillcolor("red")
t.begin_fill()
t.pendown()

for i in range(3):
    t.forward(300)
    t.left(120)

t.end_fill()
t.done()

Above is the code for drawing a triangle, 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 use this online python compiler .

When will run the program and it will open a new window and it will start drawing a triangle and below is the finished drawing of a triangle.

Triangle Drawing In Python

As you can see, we successfully drew a red triangle, I hope you found this tutorial helpful and useful, do share it with your friends who might be intrested. 

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 🙂