-1

When I try to allow the user to input a command in a timed while loop (0.1 seconds) it pauses at the input and doesn't get to the time.sleep() until the user enters something. For example:

while True:
    [something happens]

    userInput = input("Type something")

    if userInput = "foo":
        [another thing happens]

    time.sleep(0.1)

I want the loop to run normally if there is no user input and process the user input if there is without pausing the entire loop.

Duncan Leung
  • 142
  • 1
  • 11

1 Answers1

0

Calling the input function requires it to wait until the user types something.