Skip to content
Sign upLog in
← Back to Community

How to make a progress bar!

Profile icon
Wumi4

Hello again!

When you are install a package/software/repo, you may see a progress bar look somewhat like this:

progressbar

And in this tutorial I will show you how to make a progress bar looks like that!

Install

First, you need to install a package called tqdm to make the progress bar, to install it, you must check if pip is installed or not by type:
pip
If you see a message look like this:
pip is not recognized as an internal or external command, operable program or batch file.
That mean you have not installed pip, you can go to this website to know how to install it on Windows
If you are using Linux, you can type this command to install pip:
sudo <pmn> install python-pip
While the <pmn> is the package manager name (e.g. apt, dnf,...)
If pip is installed, type this command on your Terminal if you are using Linux:
pip3 install tqdm
With Windows, type:
pip install tqdm
When the package is installed, let's go to the next part

Coding

Now, type python(Windows) or python3(Linux) on CMD/Terminal to run Python
Then you type:

from tqdm import tqdm import time

To import packages
Now, we will make a "for" loop:

for i in tqdm(range(50000)): time.sleep(0.1)

Then, you will see a progress bar look like this:

progressbar2

And THAT's the end of this tutorial, pls upvote it if you like it! :)

Edit: If you want more infomation, you can go to this website

Voters
Profile icon
HamdyIbrahim1
Profile icon
MercedesElliot
Profile icon
Wumi4
Comments
hotnewtop
Profile icon
CodeLongAndPros

Now, type python(Windows) or python3(Linux) on CMD/Terminal to run Python

On most distros, python3 is symlinked to python.

Profile icon
Wumi4

@CodeLongAndPros
I know, but in some old distros(even some new one), they still use Python 2.7 when you type python on the Terminal. So thats why I say to type python3 to open the Python 3.7.5
e.g. I have use Debian 10(by using Userland), but when I type python, It show the Python 2.7

Profile icon
CodeLongAndPros

@DangHoang2
While I'm at it, it should be python3 -m pip

Profile icon
CodeLongAndPros

@DangHoang2
I guess I'm spoiled with Arch+Manjaro