Improved spinner

This commit is contained in:
2021-03-05 16:27:38 +01:00
parent 570ede237e
commit 1dfae27d88
3 changed files with 16 additions and 16 deletions

View File

@@ -75,11 +75,10 @@ class Console:
args = []
colored_args = []
if x is not None and y is not None:
args.append(f'\033[{x};{y}H')
args.append(f'\033[{y};{x}H')
elif cls._x is not None and cls._y is not None:
args.append(f'\033[{cls._x};{cls._y}H')
args.append(f'\033[{cls._y};{cls._x}H')
colored_args.append(string)
if cls._foreground_color != ForegroundColor.default and cls._background_color == BackgroundColor.default:
@@ -96,7 +95,6 @@ class Console:
"""
Useful public methods
"""
@classmethod
def banner(cls, string: str):
if cls._disabled:

View File

@@ -17,11 +17,13 @@ class SpinnerThread(threading.Thread):
yield cursor
def run(self) -> None:
self._console.write('\t')
spinner = self._spinner()
while self._is_spinning:
self._console.write(next(spinner))
time.sleep(0.1)
self._console.write('\b')
self._console.flush()
self._console.write(' ')