import threading
import itertools
import time
import sys
print("Press enter to stop")
print("thread1: - thread2: -", end="")
def print_at(x, msg):
print("\r" + "\033[%dC" % x + msg, end="")
def func(x, symbols):
while True:
print_at(x, next(symbols))
time.sleep(0.1)
def wait_and_finish():
input()
sys.exit(0)
thr1 = threading.Thread(target=func, args=(9, itertools.cycle(['-', '\\', '|' ,'/' ])), daemon=True)
thr2 = threading.Thread(target=func, args=(20, itertools.cycle(['-', '\\', '|' ,'/' ])), daemon=True)
thr1.start()
thr2.start()
wait_and_finish()