How to Add a Progress Bar to Your ‘for’ Loops in Python
A guide on how to add a simple progress bar to your Python code using the Rich library.
Hello World!

Today we are going to take a look at how to add a simple progress bar to your Python code using a library named Rich.
I’ve already talked about this library in my post about creating tables inside your terminal:
For those who have never seen this library, Rich is a Python package for rich text and beautiful formatting in the terminal. It is pretty easy to use and fast to integrate into your projects. With this package you can do a lot of cool things in your terminal, here’s a brief example from the GitHub webpage:

Today we are going to keep it simple and just have a look at how to show a progress bar for your code.
As usual, I’ll divide the post into paragraphs so feel free to skip ahead.
0. Requirements and Target
For this tutorial you’ll need:
- Python 3.x
- The following package: rich
We are going to install the requirements (except for Python) in the next step.
The tutorial is targeted at:
- Python beginner programmers
- People who want to learn more about TUIs (Terminal User Interfaces) in Python
1. Installing the requirements
rich
The first thing we need to do is install the requirements. In this tutorial, we are going to use rich to create our progress bar.
To install the package we just need to write in the terminal:
pip install richIf you want to take a look at the documentation you’ll find it here:
2. Creating our for loop
Now that we’ve installed the package, we need to create a code snippet to work with:










