A simple progress bar with the ILoveCandy style
Project description
CandyBar
A Progress Bar inspired by Arch pacman with ILoveCandy
option enabled.
Instalation
Python
Manual instalation
Clone the repository, build, and install the package:
git clone https://github.com/MacDumi/CandyBar.git
cd CandyBar
pip install .
Install from PyPi
pip install candy_bar
C++
Don't like Python
? Use it with C++
!
Clone the repository and either install the library or build against it:
git clone https://github.com/MacDumi/CandyBar.git
cd CandyBar
make && make install
Usage
Import the package and create the progress bar object:
# Python
from candy_bar import CandyBar
cb = CandyBar(100, "Progress")
// C++
#include "candybar.h"
...
CandyBar cb(100, "Progress");
Parameters
Parameter | Default | Description |
---|---|---|
total | 100 | Defines the value corresponding to 100% |
message | None |
Write some text at the beginning of the line |
width | console size |
Size (in chars) of the bar, by default max console size |
left_justified | True | Defines the justification of the bar (not the message text) |
disable | False | When set, the progress bar will be disabled |
To update the position of the progress bar use the update
method:
# Python
total = 100
for i in range(total + 1):
# Your code goes here
cb.update(i)
// C++
int total = 100;
for (int i = 0; i <= total; i++)
{
// Your code goes here
cb.update(i);
}
The progress bar can be disabled:
# Python
def function(verbose):
...
cb.disable(not verbose)
...
// C++
void function(bool verbose)
{
...
cb.disable(!verbose);
...
}
The total value, the message, and the justification of the progress bar can be changed:
# Python
cb.set_total(150)
cb.set_message("Another message")
cb.set_left_justified(False)
// C++
cb.set_total(150);
cb.set_message("Another message");
cb.set_left_justified(false);
Like what I do?
Buy me coffee
85jJPcfLPZRUKm3Re6qHZsKBZskVS2tYMWFoY5sYXUSQJzqzqpuPFepXMtqTKCRfuhYXaiJ3zQVeRPDYJUfepVjnJDpApH5
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file candy_bar-1.3.5.linux-x86_64.tar.gz
.
File metadata
- Download URL: candy_bar-1.3.5.linux-x86_64.tar.gz
- Upload date:
- Size: 175.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4abacb4dfdd365273fb27a940cd1784e9b7cfccaabaa573c92bdc4bdb00c890 |
|
MD5 | e1aac36bbdc5d8aed4c270e76201d4e5 |
|
BLAKE2b-256 | 423e778cb0ce6355e88f55abdb8da68594d8877fabbf675b8ddde249967eb94c |
File details
Details for the file candy_bar-1.3.5-py3.10-linux-x86_64.egg
.
File metadata
- Download URL: candy_bar-1.3.5-py3.10-linux-x86_64.egg
- Upload date:
- Size: 176.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f13bc54b73a502aaa8f248351d8d763569cf4ecf23d6f472cb0f07952e81ea5 |
|
MD5 | d4f604713823fa728cd904e78c1615f2 |
|
BLAKE2b-256 | a806c386c25fa4eb126d50cc5f6b8b935ca6f5f9b66ecefae09ff8dbe781f9c0 |