需要支持使用 pyautogui 制作 python 增量循环
need support making a python increment loop using pyautogui
这是我使用 python 的第二天,所以放轻松,
这是我的代码
pyautogui.press('down')
time.sleep(0.5)
pyautogui.click((848, 480))
time.sleep(0.5)
pyautogui.click((350, 280))
time.sleep(0.5)
我希望能够循环播放,但每次循环播放时都会在顶部添加另一个 pyautogui.press('down'),
现在只是在代码中手动重复,越来越长,很糟糕。
您不能向脚本中添加命令,但可以循环执行 pyautogui.press()
命令:
#We declare the repeat variable.
repeat=1
#Loop...
while True:
#Repeat the command as much times as the repeat variable states.
for _ in range(repeat):
pyautogui.press('down')
#Rest of the code...
time.sleep(0.5)
pyautogui.click((848, 480))
time.sleep(0.5)
pyautogui.click((350, 280))
time.sleep(0.5)
#We increment the amount of times the pyautogui.press() command will be called.
repeat+=1
这是我使用 python 的第二天,所以放轻松,
这是我的代码
pyautogui.press('down')
time.sleep(0.5)
pyautogui.click((848, 480))
time.sleep(0.5)
pyautogui.click((350, 280))
time.sleep(0.5)
我希望能够循环播放,但每次循环播放时都会在顶部添加另一个 pyautogui.press('down'), 现在只是在代码中手动重复,越来越长,很糟糕。
您不能向脚本中添加命令,但可以循环执行 pyautogui.press()
命令:
#We declare the repeat variable.
repeat=1
#Loop...
while True:
#Repeat the command as much times as the repeat variable states.
for _ in range(repeat):
pyautogui.press('down')
#Rest of the code...
time.sleep(0.5)
pyautogui.click((848, 480))
time.sleep(0.5)
pyautogui.click((350, 280))
time.sleep(0.5)
#We increment the amount of times the pyautogui.press() command will be called.
repeat+=1