我使用 Python2.7,Win7 32bit。
import pyautogui
pyautogui.confirm(text=u'XXXX', title=r'XX', buttons=['OK', 'Cancel'])
pyautogui.click()
错误:
Traceback (most recent call last):
File "VisualNovelForScroll.py", line 28, in <module>
pyautogui.click()
File "F:/Anaconda2/Lib/site-packages\pyautogui\__init__.py", line 362, in click
platformModule._click(x, y, 'left')
File "F:/Anaconda2/Lib/site-packages\pyautogui\_pyautogui_win.py", line 437, in _click
_sendMouseEvent(MOUSEEVENTF_LEFTCLICK, x, y)
File "F:/Anaconda2/Lib/site-packages\pyautogui\_pyautogui_win.py", line 480, in _sendMouseEvent
raise ctypes.WinError()
WindowsError: [Error 1400] 无效的窗口句柄。
我的 Windows 语言是中文。典型的句柄是什么意思invalid windows handle
我尝试获取鼠标位置并将其作为参数发送到pyautogui.click()
但是我得到了同样的错误。
pyautogui.confirm(text=u'XXXX', title=r'XX', buttons=['OK', 'Cancel'])
currentMouseX, currentMouseY = pyautogui.position()
pyautogui.click(currentMouseX, currentMouseY)
另一个失败的尝试:
pyautogui.confirm(text=u'XXXX', title=r'XX', buttons=['OK', 'Cancel'])
currentMouseX, currentMouseY = pyautogui.position()
pyautogui.moveTo(currentMouseX, currentMouseY)
pyautogui.click()
提前致谢。任何建议将被认真考虑。