Python how to make simple animated loading while process is running

前端 未结 6 1784
广开言路
广开言路 2020-12-13 03:30

This is pretty much what I have right now:

import time
import sys

done = \'false\'
#here is the animation
def animate():
    while done == \'false\':
               


        
6条回答
  •  粉色の甜心
    2020-12-13 04:05

    Its all done with a few lines of code:

    import time
    import os
    
    anime = ["|", "/", "-", "\\"]
    
    done = False
    
    while done == False:
        for i in anime:
            print('Please wait while system is Loading...', i)
            os.system('clear')
            time.sleep(0.1)
    
    

    Tested and working successfully in the terminal.

提交回复
热议问题