python - pyautogui Python 3.6 与 ok 按钮交互

标签 python pyautogui

我想使用 pyautogui.alert 函数,并且希望在用户单击“确定”按钮后执行特殊操作。我如何与此按钮交互?

pyautogui.alert (text = '', title = '', button = 'OK')

最佳答案

或者你可以这样做:

# display the alert
alert = pyautogui.alert(text = '', title = '', button = 'OK')
# check to see if "OK" was pressed
if alert.upper() == "OK":
    # do something

关于python - pyautogui Python 3.6 与 ok 按钮交互,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59255225/

相关文章:

python - 使用 Dagster 进行交叉验证

python - 返回最长摆动子数组

python - 如何在 python 2.7 中使用 pyautogui 获取屏幕图像坐标

python - 在 Python 中将突出显示的文本复制到剪贴板

python - 使用 pyautogui 检查图像是否在屏幕上的最快方法

python-3.x - 带有 pyautoGUI 模块的 Python 操作系统

python - 如何在 Python PyAutoGUI 中更改键盘

python - 解释 Python 变量作用域

python - 获取图像中的所有 R-G-B

python - 压缩目录目标