使用pyautogui确认后单击时出错

2024-09-29 23:18:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我用Python2.7,Win7 32位。在

import pyautogui
pyautogui.confirm(text=u'XXXX', title=r'XX', buttons=['OK', 'Cancel'])
pyautogui.click()

错误:

^{pr2}$

我的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()

提前谢谢。如有任何建议,我们将不胜感激。在


Tags: texttitle错误positionokcancelconfirmclick

热门问题