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

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

How to Draw a Rectangle in Python - There are various methods to create a Rectangle using python libraries like turtle, tkinter and matplotlib. Also, you will learn how to make a Rectangle using python in easy and simple steps. We have also provided the python code for drawing a Rectangle 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 Rectangle patterns in Python using libraries from its scientific stack, including NumPy, Matplotlib, Pandas, and Seaborn.

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

## How to Draw a Rectangle using Python?

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

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

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

## How to Draw a Rectangle using Python Turtle?

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

Step

Code

# draw Rectangle in Python Turtle
import turtle

t = turtle.Turtle()

l = int(input("Enter the length of the Rectangle: "))
w = int(input("Enter the width of the Rectangle: "))

# drawing first side
t.forward(l) # Forward turtle by l units
t.left(90) # Turn turtle by 90 degree

# drawing second side
t.forward(w) # Forward turtle by w units
t.left(90) # Turn turtle by 90 degree

# drawing third side
t.forward(l) # Forward turtle by l units
t.left(90) # Turn turtle by 90 degree

# drawing fourth side
t.forward(w) # Forward turtle by w units
t.left(90) # Turn turtle by 90 degree

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

## How to Draw a Rectangle using Python Tkinter?

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

Step

Code

Output

## How to Draw a Rectangle using Python Matplotlib?

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

Step

Code

Output

## How to Draw a Rectangle 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 Rectangle using Python

We hope the programs and methods provided above on how to make a Rectangle 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: