So very recently, I have started learning python, and I have come up with a very basic script that should ask the user a question, and move the courser to a spot on the screen based on the answer that the program receives. But when I run the program it runs the first part of the code, then closes the interpreter as if the program was finished.
import pyautogui
import time
choice = 0
choice = pyautogui.prompt("Which option do you choose? ")
# The code stops working here
if choice == 1:
pyautogui.moveTo(670, 440)
elif choice == 2:
pyautogui.moveTo(690, 440)
elif choice == 3:
pyautogui.moveTo(670, 500)
elif choice == 4:
pyautogui.moveTo(690, 500)
I believe that the issue is with the if / then command but is could be something as simple as an indention error.
I apologise in advance for any formatting mistakes that I made when typing up this question as I am quite new to stack overflow.
Aucun commentaire:
Enregistrer un commentaire