From 6553b7b207113d70998ff36b13a05a9b36837f79 Mon Sep 17 00:00:00 2001 From: Georgios Verigakis Date: Tue, 10 Jul 2018 13:32:05 +0300 Subject: [PATCH] Implement `write` using \r instead of \b This is to appease PyCharm that doesn't implement \b. --- progress/helpers.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/progress/helpers.py b/progress/helpers.py index 5cf66f1..530927e 100644 --- a/progress/helpers.py +++ b/progress/helpers.py @@ -37,9 +37,8 @@ class WriteMixin(object): def write(self, s): if self.file and self.is_tty(): - b = '\b' * self._width - c = s.ljust(self._width) - print(b + c, end='', file=self.file) + line = self.message + s.ljust(self._width) + print('\r' + line, end='', file=self.file) self._width = max(self._width, len(s)) self.file.flush()