DEV Community

Cover image for Write a responsive progressbar for the commandline using Python.
Deepjyoti Barman
Deepjyoti Barman

Posted on • Originally published at deepjyoti30.github.io

2 2

Write a responsive progressbar for the commandline using Python.

We have all seen progressbars everywhere. We see them on websites all the time and those of us who use a Linux distro, looking at a progressbar is like one of our day to day tasks. Especially when you use the terminal like you can nuke a country from it. Progressbars are used by a lot of commandline software's we use. Python's pip use them, npm has an awesome progressbar along with a spinner and our holy pacman, obviously has one too.

However, progressbars are sometimes messy. If you've used pip more than just a couple of times, it is unavoidable to notice that the progressbar's size is predefined. What that means is, the bar doesn't resize depending on the width of the terminal, messing up the output a lot of times.

Alt Text

Though, pip's bar might not be responsive, pacman has a really neat bar that hardly screw's up. The length of the bar changes according to the width of the terminal.

So how can we make a responsive, awesome progressbar ourselves? Read ahead and you'll know.

Read the rest of the article here

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay