Created
December 18, 2021 23:59
-
-
Save DiegoVallejoDev/da1f9179d356291e2a4bad6ba239f657 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ProgressBar: | |
def __init__(self): | |
self.bar = [ | |
" [= ]", | |
" [ = ]", | |
" [ = ]", | |
" [ = ]", | |
" [ = ]", | |
" [ =]", | |
" [ = ]", | |
" [ = ]", | |
" [ = ]", | |
" [ = ]", | |
] | |
self._i = 0 | |
def show(self, msg=""): | |
print(self.bar[self._i % len(self.bar)], msg, end='\r') | |
self._i += 1 | |
def done(self, msg=""): | |
print(f"\r [======] {msg}") | |
def __str__(self): | |
return self.bar[self._i % len(self.bar)] | |
p = ProgressBar() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment