Handful of utilities to do printing tricks to the terminal.
Project description
printBuddies
A few utilities to do terminal printing tricks.
Install with:
pip install printBuddies
Contains one class and three functions: ProgBar, printInPlace, ticker, and clear.
ProgBar is a self-incrementing, dynamically sized progress bar.
The progress counter and completion values can be manually overriden if desired.
The width of the progress bar is set according to a ratio of the terminal width
so it will be resized automatically if the terminal width is changed.
The display function has a 'returnObject' parameter, allowing ProgBar to be used in comprehensions.
Basic usage:
from printBuddies import ProgBar total = 100 progBar = ProgBar(total=total-1) for _ in range(total): progBar.display() progBar.reset() myList = [progBar.display(returnObject=i) for i in range(total)]
printInPlace erases the current line in the terminal and then writes the value of the 'string' param to the terminal.
from printBuddies import printInPlace import time #This will print numbers 0-99 to the terminal with each digit overwriting the last. for i in range(100): printInPlace(i) time.sleep(0.1)
ticker prints a list of strings to the terminal with empty lines above and below such that previous text in the terminal is no longer visible.
Visually, It functions as a multi-line version of printInPlace.
from printBuddies import ticker import time #This will produce visually the same output as the above example for i in range(100): ticker([i]) time.sleep(0.1)
A call to clear() simply clears the current line from the terminal.
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 printbuddies-0.4.0.tar.gz
.
File metadata
- Download URL: printbuddies-0.4.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a449183fe6056ab527903203f342cebf61594f57e595d07e5e59711752e9bf8 |
|
MD5 | e4d600e662b90ea69420ab767f6d6f2d |
|
BLAKE2b-256 | 1126b9e136b565a41f1a853f12dc19b7e486e675d5592409f6f84411ba4b690f |
Provenance
File details
Details for the file printbuddies-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: printbuddies-0.4.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45928adf2a0e1ee96f16561953939e71701afaa0c4d5c95dfc9a694c2503d795 |
|
MD5 | 932ea71c9799fa7b6bce33fefb57f15a |
|
BLAKE2b-256 | 9d4fefbd675fd3ac6541944409dd278356c2bb054844f19b0163c80fef9be4fd |