/pygrape

pygrape is a python library for updating terminal output in realtime

Primary LanguagePythonMIT LicenseMIT

pygrape

Build Status PyPI version

pygrape is a python library for updating terminal output in realtime

Usage

pip3 install pygrape

Example

from pygrape import pygrape
import time

def main():
    #  Initialize the pygrape, 0.05 is the interval
    writer = pygrape(0.05)
    print("Downloading pygrape.whl (2 MB)")
    bar = "█"
    for i in range(101):
        time.sleep(0.05)
        # It only print fifty bars.
        if i % 2 == 0:
            bar += "█"
        writer.writer(" " + str(i) + "% |" + bar + "|")
        writer.flush()
    # Finish the printing
    writer.stop()

if __name__ == '__main__':
    main()

Result

gif

License

MIT