Answer the question
In order to leave comments, you need to log in
How to make a switch?
and so hello. I decided to make a switch for my autoclicker bot. I wanted that when I wrote "stop" in the terminal, it turned off, and when "go" it turned on. I decided to do it through a while loop and ran into this problem. While the loop is not running, the "stop" command works, but once I start the loop, I can't stop it anymore. How should I write it down so that I could stop it at any time and turn it on again at any time?
import pyautogui,time, keyboard
pyautogui.PAUSE = 0.00001
#time.sleep(5)
key = "alt"
while True:
pov = False
trx = input("")
words = trx.split()
if words[0] == "stop":
pov = False
print("выключено")
if words[0] == "go":
pov = True
print("включено")
while pov:
if keyboard.is_pressed(key):
try:
pyautogui.click(clicks=20, interval=0.0001)
except:
print("что-то пошло не так")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question