Answers:
也可以使用pyautogui作为
import pyautogui
pyautogui._autoPause(0.05,False)
如果first不为None,则它将暂停第一个arg秒,在此示例中:0.05秒
如果first为None,第二arg为True,则它将休眠以设置的全局暂停设置
pyautogui.PAUSE = int
如果您想知道原因,请参见源代码:
def _autoPause(pause, _pause):
"""If `pause` is not `None`, then sleep for `pause` seconds.
If `_pause` is `True`, then sleep for `PAUSE` seconds (the global pause setting).
This function is called at the end of all of PyAutoGUI's mouse and keyboard functions. Normally, `_pause`
is set to `True` to add a short sleep so that the user can engage the failsafe. By default, this sleep
is as long as `PAUSE` settings. However, this can be override by setting `pause`, in which case the sleep
is as long as `pause` seconds.
"""
if pause is not None:
time.sleep(pause)
elif _pause:
assert isinstance(PAUSE, int) or isinstance(PAUSE, float)
time.sleep(PAUSE)
time.sleep
而不是使用此方法,但是如果您希望您的程序是纯autopygui,则可以使用这种方法。