PyAutoGUI快速入门指南(4)
Message Box 消息弹出框
如果需要暂停程序,直到用户单击“确定”
,或者希望向用户显示某些信息,则可以使用Message Box
消息框函数,其具有与JavaScript
相似的名称:
alert()
提示框,仅有确定
按钮。
>>> pyautogui.alert('This displays some text with an OK button.')
confirm()
提示框,有确定
和取消
按钮。
>>> pyautogui.confirm('This displays text and has an OK and Cancel button.')
'OK'
prompt()
有一个输入框,允许用户输入,还有确定
和取消
按钮。
>>> pyautogui.prompt('This lets the user type in a string and press OK.')
'This is what I typed in.'
如果用户单击取消
,prompt()
函数将返回None
。