Advertisement
Guest User

Untitled

a guest
Jun 21st, 2021
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import threading
  2. import time
  3. import sys
  4.  
  5. #not sure if you actually need this, but oh well
  6. print_lock = threading.Lock()
  7.  
  8. def print_stuff():
  9. for _ in range(5):
  10. time.sleep(1)
  11. with print_lock:
  12. print("Hello" + " "*20) #put some spaces at the end to make sure the progress message is overwritten
  13.  
  14. threading.Thread(target=print_stuff).start()
  15.  
  16. for i in range(101):
  17. with print_lock:
  18. print(f"{i}% complete.\r", end="")
  19. time.sleep(0.033)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement