Hi, I'd love to start using this library, is there any easy way to print the typical '...' progress bar? Ie, something like this:
import time
import threading
import sys
class ProgressBar():
def __init__(self):
self.start = time.time()
self.count = 0
self.completed = False
self.width = 4n
def stop(self):
self.completed = True
def print(self, msg):
while not self.completed:
elapsed = time.time() - self.start
if elapsed > 0.3:
self.start = time.time()
self.count += 1
suffix = '.' * (self.count % self.width)
suffix = suffix.ljust(self.width - self.count % self.width, ' ')
print("{}{}".format(msg, suffix), end='\r', flush=True)
if __name__ == '__main__':
pb = ProgressBar()
t = threading.Thread(target=pb.print, args=("Doing stuff",))
t.start()
time.sleep(5)
pb.stop()
t.join()
Hi, I'd love to start using this library, is there any easy way to print the typical '...' progress bar? Ie, something like this: