I have a Python script which takes a long time to run. I\'d quite like to have the command line output to have a little \'waiting\' animation, much like the swirly circle we
A loading bar useful for if you're installing something.
animation = [
"[ ]",
"[= ]",
"[=== ]",
"[==== ]",
"[===== ]",
"[====== ]",
"[======= ]",
"[========]",
"[ =======]",
"[ ======]",
"[ =====]",
"[ ====]",
"[ ===]",
"[ ==]",
"[ =]",
"[ ]",
"[ ]"
]
notcomplete = True
i = 0
while notcomplete:
print(animation[i % len(animation)], end='\r')
time.sleep(.1)
i += 1
if you want to make it last a couple seconds do
if i == 17*10:
break
after the
i += 1