Skip to main content

A python loading bar to use in terminal applications

Project description

Pyloading

How to install

Just use pip:

$ pip install pyloading-bar==0.0.2

How to use

For now pyloading_bar is a very simple package to draw a simple progress bar in the terminal:

There's two versions of the bar. The Bar (most simple version of the bar):

from pyloading_bar import Bar

number_of_steps = 2
bar = Bar(number_of_steps)
# do something
bar.next()
# do something
bar.next()

The usual bar is like this:
[##########]

And the RangeBar, this object is created to be used just like an interator on the for loop:

from pyloading_bar import RangeBar

for i in RangeBar(10):
  print(i)

You can chage the bar by the symbol parameter:

from pyloading_bar import RangeBar
  
number_of_steps = 10
for step in RangeBar(number_of_steps, symbol='@'):
  print(step)

now the bar look like this:
[@@@@@@@@@@]

or a full string and it'll iterate thru the string to display inner steps:

from pyloading_bar import RangeBar
  
number_of_steps = 10
for step in RangeBar(number_of_steps, symbol='▁▂▃▄▅▆▇█'):
  print(step)

now the bar look like this:
[█▇ ]

if you want to change the walls of the bar, you can use the template parameter: with the template you MUST use some char at the begining and at the end of the bar.

from pyloading_bar import RangeBar
  
number_of_steps = 10
for step in RangeBar(number_of_steps, template='|▁▂▃▄▅▆▇█|'):
  print(step)

now the bar look like this:
|█▇ |

And if you want that the terminal don't update the last line with the new progress bar state (the progress bar assume by default that you don't print anything to the terminal), just say to the progress bar print a new line to each step:

from pyloading_bar import Bar

# The paramenter "symbol" change the character used into the loading bar
number_of_steps = 10
for step in RangeBar(number_of_steps, symbol='@', update_terminal=False):
  print(step)

Contributors

Made with contrib.rocks.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyloading_bar-0.0.2-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file pyloading_bar-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pyloading_bar-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for pyloading_bar-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b6ad6cfe062667ab6abf17eddd2f44a9dce396281ddb5eaf268a6bf9e66867d5
MD5 9a59b398743d6773d78566ec5c67d85d
BLAKE2b-256 348b4f18f80e9e2fb5e95fcdcca6b06d380bb5b8f3b7afa52b9d350d1e4aa7a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page