Python Loading Bar
Python module to display a nice loading bar in a terminal window.
Install
Go to the module directory and run:
$ pip install setup.py
Or:
$ python3 setup.py install
Getting Started
There are 3 different loading bar:
- Standard loading bar
- Loading bar with size loaded, speed and remaining time
- Loading bar with infos above plus a custom message (usefull to display a verbose loading bar)
Option 1
Standard loading bar without any other infos.
import loading
total_file_size = 1000
# Create a loading bar object with total_file_size in bytes
lb = loadingbar.LoadingBar(total_file_size)
# For every piece of file
for chunk in file:
# Update the loading bar with the len of new data
lg.update(len(chunk))
# When finished, display a 100% loading bar
lg.done()
Option 2
Standard loading bar with infos such as size downloaded, speed, eta.
import loading
total_file_size = 1000
lb = loadingbar.InfoLoadingBar(total_file_size)
# Run as above
Option 3
This special InternetLoadingBar smooth the speed calculation by taking the overall average time rather than a instant speed.
import loading
total_file_size = 1000
lb = loadingbar.InternetLoadingBar(total_file_size)
# Run as above
Option 4
Loading bar that displays a message, like for example the filename that it is downloaded. Two options:
loadingbar.MessageLoadingBarloadingbar.VerboseLoadingBar
import loading
total_file_size = 1000
lb = loadingbar.VerboseLoadingBar(total_file_size)
# For every piece of file
for chunk in file:
# Update the loading bar with the len of new data
lg.update(len(chunk), "Message to be displayed, such as filename, etc.")
# When finished, display a 100% loading bar
lg.done()
Option 5
Add a percentage after the loading bar.
-
loadingbar.PercentageLoadingBar(tot_size) -
loadingbar.PercentageInfoLoadingBar(tot_size)
Option 6
Add a percentage after the loading bar.
-
loadingbar.PercentageBeforeLoadingBar(tot_size) -
loadingbar.PercentageBeforeLoadingBarAndInfo(tot_size)
Customization
If a new and custom loading bar is needed, you can implement a new one by inheriting from the LoadingBar class or the abstract class ILoadingBar. See loading > loading_bar.py for examples.
License
MIT license. Feel free to use, share, or improve it.
Metadata
Release files for loadingbar 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| loadingbar-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for loadingbar-1.0.0-py3-none-any.whl |
Release files / loadingbar-1.0.0-py3-none-any.whl
| Download URL | loadingbar-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cc5fab9695c1c6e8636b8675a04bbbfbd68bd1ca70f82dbaed26098c166d3d17
|
|
BLAKE2b-256 checksum How to use checksums |
19483b53f63c720fbf2b662d6b1cd29730486aa282ecec1f3574e8fea0e465bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for loadingbar 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.