pygrape是一个实时更新终端输出的python库
pygrape是一个实时更新终端输出的python库
Python 命令行工具
共26Star
详细介绍
pygrape
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
License
MIT