This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
Printr/printr/ellipsisPrintr.py

23 lines
578 B
Python
Raw Normal View History

2015-09-26 14:56:49 +01:00
class EllipsisPrintr():
2015-09-26 14:04:41 +01:00
def __init__(self, string, max=5):
self.string = string
self.max = max
self.count = -1
def update(self, commit=False):
self.clear()
ellipsis = "." * self.count
ending = '\r' if not commit else '\n'
print(self.string + ellipsis, end=ending)
if self.count >= self.max:
self.zero()
self.count += 1
def zero(self):
self.count = -1
def commit(self):
print()
def clear(self):
print(' ' * (len(self.string) + self.max), end='\r')