From 7748641a40bce3a2966b98f2af075fc3838b3aa2 Mon Sep 17 00:00:00 2001 From: niyari Date: Thu, 29 Sep 2022 04:02:57 +0900 Subject: [PATCH] Splatted ika! (Clear when finished.) --- s3s.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/s3s.py b/s3s.py index df42602..db29ec8 100755 --- a/s3s.py +++ b/s3s.py @@ -1004,11 +1004,12 @@ def monitor_battles(which, secs, isblackout, istestrun): print("Bye!") class SquidProgress: + '''Display animation while waiting.''' def __init__(self): self.count = 0 def __call__(self): - lineend = os.get_terminal_size()[0] - 4 + lineend = os.get_terminal_size()[0] - 5 # 5 = ('>=> ' or '===>') + blank 1 ika = '>=> ' if self.count % 2 == 0 else '===>' sys.stdout.write(f"\r{' '*self.count}{ika}{' '*(lineend - self.count)}") sys.stdout.flush() @@ -1016,6 +1017,10 @@ class SquidProgress: if self.count > lineend: self.count = 0 + def __del__(self): + sys.stdout.write(f"\r{' '*(os.get_terminal_size()[0] - 1)}\r") + sys.stdout.flush() + def main(): '''Main process, including I/O and setup.'''