Skip to content
Advertisement

Python infinite loop I tried with while but no luck

hi guys im new at coding im trying to create an infinite loop in the follow code

from pyautogui import *
import pyautogui
import time
import keyboard
import numpy as np
import random
import win32api, win32con
import sys 

time.sleep (2)

color = (255, 255, 255)
a = pyautogui.screenshot()

for x in range(a.width):
    for y in range(a.height):
        if a.getpixel((x, y)) == (119,  44,  44):            
            pyautogui.click(x, y)
            time.sleep(2)
            pyautogui.click(3050, 1411)
            time.sleep(35)
            a = pyautogui.screenshot()

I tried with while but no luck, can someone help me please? Thanks for the attention and have a nice day(=

Advertisement

Answer

To make infinite loop just use

while True:
    # Add your code
    pass

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement