Reputation: 35
I need the mouse go the below given axis infinitely, until i break the program.
import pyautogui, time
for i in range(0):
pyautogui.moveTo(716, 234, duration = 2)
pyautogui.moveTo(234, 600, duration = 2)
time.sleep(2)
Upvotes: 1
Views: 52
Reputation: 576
Your for loop
for i in range(0):
runs 0 times, the code in the for loop will therefore not execute. If you want the for loop to run n times you can't change the value of 0 to n.
n = 3
for i in range(n):
print("Hello!")
The above loop will output:
Hello!
Hello!
Hello!
If you need the mouse go the below given axis infinitely, until you break your program, you can use a while True
loop instead.
while True:
print("hello")
Upvotes: 0
Reputation: 476
Your for loop conditions are never met so your command to pyautogui are never called. If you need an infinite loop use 'while True:'
Upvotes: 1