• 周六. 7 月 27th, 2024

5G编程聚合网

5G时代下一个聚合的编程学习网

热门标签

PyAutoGui[winerror2]在使用Pyins将脚本转换为exe之后

King Wang

3 月 7, 2023

我只是想请你帮我解决下面的问题。
我的代码运行得很好,但是在使用PyInstaller将其转换为.exe之后,我将遇到{}。在

请告诉我怎样才能修好它。在

FileNotFound:[WinError 2]

代码:

import pyautogui, time

try:
    while True:
        time.sleep(30)
        pyautogui.dragRel(1,0)
        pyautogui.dragRel(-1,0)

except keyboardInterrupt:
    print('Done')

Tags:

代码importtruetimesleepexeprinttrypyinstallerexceptwhile代码运行pyautoguikeyboardinterruptdragrel1条回答网友

1楼 ·

发布于 2023-03-07 00:10:53

我对PyAutoGUI和PyInstaller也有同样的问题,无法通过点击来工作。不过,移动鼠标和图像识别似乎可以工作。在

多亏了这篇文章,here我找到了一个“变通办法”:

而不是使用pyautogoi.click()方法,我使用的是来自ctypes的类似方法。在

import ctypes

我交换了pyautogui.click()与

^{pr2}$

对于双击,我只调用这两个方法两次。在

发表回复