Advertisement
furas

Python - thread and dots as progressbar

May 24th, 2018
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. import threading
  2. import time
  3.  
  4. def run_request():
  5.     # simulate long-running request
  6.     time.sleep(10)    
  7.  
  8. #---
  9.    
  10. subthread = threading.Thread(target=run_request)
  11. subthread.start()
  12.  
  13. while True:
  14.     if not subthread.is_alive():
  15.         break
  16.  
  17.     time.sleep(0.5) # to slowdown progressbar
  18.     print('.', end='', flush=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement