python - How do I make a program that shows a simple loading screen? See below for more details -
i wrote -
import time timeout = time.time() + 2 dot, = ".", 0 while timeout > time.time(): print ("loading" + dot*i, end = "\r") time.sleep (0.1) if == 3: = 0 else: += 1
it runs fine till "loading...", need go "loading" , loop till time expires. ps - i'm running on windows powershell.
after 3 dots return , draw 1. 2 previous ones remain!
just include (3-i) whitespaces after dots
print ("loading" + dot*i + ' '*(3-i), end = "\r")
by way, sleep of 0.1 make dots fast, try bigger sleep better visualization
wiki
Comments
Post a Comment