1
0
mirror of https://github.com/gryf/coach.git synced 2025-12-17 19:20:19 +01:00

progress bar update

This commit is contained in:
itaicaspi-intel
2018-09-13 15:03:24 +03:00
parent 607ef17431
commit 99649c1626

View File

@@ -558,14 +558,15 @@ class ProgressBar(object):
self.max_value = max_value
self.current_value = 0
def update(self, current_value):
def update(self, current_value, additional_info=""):
self.current_value = current_value
percentage = int((100 * current_value) / self.max_value)
sys.stdout.write("\rProgress: ({}/{}) Time: {} sec {}%|{}{}| "
sys.stdout.write("\rProgress: ({}/{}) Time: {} sec {}%|{}{}| {}"
.format(current_value, self.max_value,
round(time.time() - self.start_time, 2),
percentage, '#' * int(percentage / 10),
' ' * (10 - int(percentage / 10))))
' ' * (10 - int(percentage / 10)),
additional_info))
sys.stdout.flush()
def close(self):