Jan-24-2020, 03:25 PM
Hi everyone,
I have some code for a loading bar animation that I would like to run during execution of specific functions. I know some sort of while loop would be used for this, but no matter what I try, it just doesn't do what I want.
Here's the logic I want:
I have some code for a loading bar animation that I would like to run during execution of specific functions. I know some sort of while loop would be used for this, but no matter what I try, it just doesn't do what I want.
Here's the logic I want:
while function1() is running: animationFunction()Here's the animation code:
import time bar = [ " [= ]", " [ = ]", " [ = ]", " [ = ]", " [ = ]", " [ =]", " [ = ]", " [ = ]", " [ = ]", " [ = ]", ] i = 0 while True: print(bar[i % len(bar)], end="\r") time.sleep(.2) i += 1I tried a while true, but I'm not sure if or how to say "while function 1 runs" (while function1 true?) in correct python syntax.