# HSSlive: Plus One & Plus Two Notes & Solutions for Kerala State Board

## How to Draw a Triangle Using Python Turtle, Tkinter, Matplotlib & Without Libraries

How to Draw a Triangle in Python - There are various methods to create a Triangle using python libraries like turtle, tkinter and matplotlib. Also, you will learn how to make a Triangle using python in easy and simple steps. We have also provided the python code for drawing a Triangle pattern. If you have introductory to intermediate knowledge in Python and statistics, then you can use this article as a one-stop shop for building and plotting Triangle patterns in Python using libraries from its scientific stack, including NumPy, Matplotlib, Pandas, and Seaborn.

Plotting a Triangle in python is a simple procedure, and python in its simplest provides multiple easy methods to do so.

## How to Draw a Triangle using Python?

Given below is the process to draw a Triangle in python using libraries like Turtle, Tkinter, Matplotib and others.

Four Method to make a Triangle in Python using multiple libraries:

1. How to draw a Triangle using python turtle?
2. How to draw a Triangle using python tkinter?
3. How to draw a Triangle using python matplotlib?
4. How to draw a Triangle using python code without library?

## How to Draw a Triangle using Python Turtle?

Check below step by step process to make a Triangle using the python turtle library.

Step

Code

import turtle

# Screen() method to get screen
wn=turtle.Screen()

# creating tess object
tess=turtle.Turtle()

def triangle(x,y):

# it is used to draw out the pen
tess.penup()

# it is used to move cursor at x
# and y position
tess.goto(x,y)

# it is used to draw in the pen
tess.pendown()
for i in range(3):

# move cursor 100 unit
# digit forward
tess.forward(100)

# turn cursor 120 degree left
tess.left(120)

# Again,move cursor 100 unit
# digit forward
tess.forward(100)

# special built in function to send current
# position of cursor to triangle
turtle.onscreenclick(triangle,1)

turtle.listen()

# hold the screen
turtle.done()

Output

 How to Draw a Triangle Using Python Turtle, Tkinter, Matplotlib & Without Libraries

## How to Draw a Triangle using Python Tkinter?

Check below step by step process to make a Triangle using the python tkinter library.

Step

Code

Output

## How to Draw a Triangle using Python Matplotlib?

Check below step by step process to make a Triangle using the python matplotlib library.

Step

Code

Output

## How to Draw a Triangle using Python Code without Library?

Step

Code

Output

Note: Also, these codes might not run in an online compiler please use an offline compiler. Programmers can make any changes in the code according to their specific requirement.

## Conclusion on How to Draw a Triangle using Python

We hope the programs and methods provided above on how to make a Triangle using python libraries have been helpful to you. If there is any issue in any of the code please let us know in the comments. We will try to resolve it as soon as possible.

Share: