Input() and threading

Viewed 61

I'm trying to create application which needs to get user input data while it prints things in a console at the same time.

import threading
import time

def F1():
    for i in range (100):
        print (i)
        time.sleep(1)
def input_data():
    txt = input('>')
    print(txt)

w1 = threading.Thread(target=F1)
w2 = threading.Thread(target=input_data)
w1.start()
w2.start()

But this way function input() stops all threads. Is it possible to do it asynchronously in a python interpreter? (I know that i could do it in tkinter easily.)

0 Answers
Related