Skip to content
Sign upLog in
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
3

How to make a progress bar!

Wumi4
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

2 years ago

Voters

Comments

TopNew
1
CodeLongAndPros
CodeLongAndPros

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

On most distros, python3 is symlinked to python.

2 years ago
1
Wumi4
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

2 years ago
1
CodeLongAndPros
CodeLongAndPros

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

2 years ago
1
CodeLongAndPros
CodeLongAndPros

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

2 years ago
Load more