Skip to content

Instantly share code, notes, and snippets.

@DiegoVallejoDev
Created December 18, 2021 23:59
Show Gist options
  • Save DiegoVallejoDev/da1f9179d356291e2a4bad6ba239f657 to your computer and use it in GitHub Desktop.
Save DiegoVallejoDev/da1f9179d356291e2a4bad6ba239f657 to your computer and use it in GitHub Desktop.
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