2021-06-29

Keyboard input with timeout in while-loop [duplicate]

Code:

answer = None

def check():
    time.sleep(2)
    if answer != None:
        return
    print("Too Slow")

while True:
    current_kw = 0
    money = 100000  #100.000
    profit= current_kw * 300
    money += profit
    Thread(target = check).start()
    x = input('x: \n')
    ...

What I would like to achieve and what doesn't work:

Skip only works once instead of always

What I've tried:

See Code and Python 3 Timed Input



from Recent Questions - Stack Overflow https://ift.tt/3jo4voC
https://ift.tt/eA8V8J

No comments:

Post a Comment