Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def draw_progress(self):
- total = 1 if self.nb_total == 0 else self.nb_total
- percent_done = (self.nb_done / total) * 100
- percent_error = (self.nb_error / total) * 100
- percent_total = percent_done + percent_error
- nb_done_and_error = self.nb_done + self.nb_error
- ratio = (percent_total / 100) * self.progress_size
- width = math.floor(ratio)
- empty = self.progress_size - width - 1
- slice_char = "" if empty < 0 else self.chars[math.floor((ratio % 1) * len(self.chars))]
- bar = '[{0}{1}]'.format('█' * width + slice_char, ' ' * empty)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement