Do Something While User Input Not Received
In Python, in what way can I do something on loop while user has not given an input. I have python client and I ask for user input, but while user has not given an input I'd like
Solution 1:
Maybe this can get you started:
from threading import Thread
from time import sleep
result = None
def update_every_second():
while result is None:
sleep(1)
print "update"
t = Thread(target=update_every_second)
t.start()
result = raw_input('? ')
print "The user typed", result
Post a Comment for "Do Something While User Input Not Received"