Skip to main content

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


Download files

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

Source Distribution

printbuddies-0.4.1.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

printbuddies-0.4.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file printbuddies-0.4.1.tar.gz.

File metadata

  • Download URL: printbuddies-0.4.1.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

Hashes for printbuddies-0.4.1.tar.gz
Algorithm Hash digest
SHA256 48f282ed4c1c3e4dc3f82c3f7427e941abc98f41ca5cbbec8251f16123442cbe
MD5 e14eb7a3ca674ffcdc2c88017d590678
BLAKE2b-256 a266e95d0b79527aecd95c67eac667673761891dc8c575ec34472903de8142b1

See more details on using hashes here.

Provenance

File details

Details for the file printbuddies-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for printbuddies-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 74e9118149a0c936ed68409e125fc418e4efe9dfa5e1a57595461c27df407b32
MD5 845a26014802b034855999ab7b322f86
BLAKE2b-256 4f85df3dbf7833487218ca09875a831f5495fe007057090eb41f9a57860e0255

See more details on using hashes here.

Provenance

Supported by

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