'How can I make an auto clicker with pyautogui only when I activate it

I have been wanting to make this for a while and have finally gotten around to it. But could not get it to work. I need it to be able to work on macOS Linux and windows, I also need it to be able to be deactivated and activated with the press of a button. This is what I have tried. ` import pyautogui import time

while True: cookie = pyautogui.locate("cookie.png") pyautogui.click("cookie.png") `



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source