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

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

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

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

## How to Draw a Shape using Python?

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

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

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

## How to Draw a Shape using Python Turtle?

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

Step

Step 1: Take lengths of side for different shapes as input.

Step 2: Use different turtle methods like forward() and left() for drawing different shapes.

Code

```import turtle
t = turtle.Turtle()
#SQUARE
side = int(input("Length of side: "))
for i in range(4):
t.forward(side)
t.left(90)
#RECTANGLE
side_a = int(input("Length of side a: "))
side_b = int(input("Length of side b: "))
t.forward(side_a)
t.left(90)
t.forward(side_b)
t.left(90)
t.forward(side_a)
t.left(90)
t.forward(side_b)
t.left(90)
#CIRCLE
#HEXAGON
for i in range(6):
t.forward(side)
t.left(300)```

Output

```SQUARE:
Length of side: 100 RECTANGLE:
Length of side a: 100
Length of side b: 20 CIRCLE: HEXAGON:Length of side: 100 ```

## How to Draw a Shape using Python Tkinter?

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

Step

Code

Output

## How to Draw a Shape using Python Matplotlib?

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

Step

Code

Output

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

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