Jump to content

Python, Pyautogui, my while true loop doesn't continue

This is the updated code the loop works but the w a s d won't stop the program
<import pyautogui, time
time.sleep(5)
while True:
    letter = "e"
    pyautogui.press(letter)
    pyautogui.click()

    if (input == "w" or input == "a") or (input =="s" or input =="d"):
        break   #this is your stop() function>
Link to post
Share on other sites

What is input in this context? The variable isn't declared.

 

In any case, small code prettification:

    if input in ["w", "a", "s", "d"]:
        break   #this is your stop() function>

 

 

 

I like cute animal pics.

Ryzen 7 5800X3D + RTX 5080 | see profile for full system details

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×