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, print_in_place, ticker, and clear.
ProgBar
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 'return_object' parameter, allowing ProgBar to be used in comprehensions.
from printbuddies import ProgBar total = 100 bar = ProgBar(total=total-1) for _ in range(total): bar.display() bar.reset() my_list = [bar.display(return_object=i) for i in range(total)]
print_in_place
'print_in_place' erases the current line in the terminal and then writes the value of
the 'string' param to the terminal.
from printbuddies import print_in_place import time #This will print numbers 0-99 to the terminal with each digit overwriting the last. for i in range(100): print_in_place(i) time.sleep(0.1)
ticker
'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 print_in_place.
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)
clear
A call to printbuddies.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
Hashes for printbuddies-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69c8b6c1736d1202b7f48a0d640a879c64a9d085221c2e9606f367934da97ab8 |
|
MD5 | 56021722a577e0b54b26cc0cbc6df389 |
|
BLAKE2b-256 | 8c81d4003c76db0ca802e7a1f4c9337c568a14392d5dd23e96bee3f22f399d66 |