Python 提高pyautogui.press速度

Python 提高pyautogui.press速度,python,ocr,cv2,pyautogui,Python,Ocr,Cv2,Pyautogui,我正在为10fastfingers.com编写一个自动打字机器人。它起作用了 我正在使用pytesseract库查找文本,然后使用pyautogui按键。 我知道pyautogui.press并没有这么快 我发现类似pyautoguide.press的东西,但速度很快。 像 研究剧本 pyautogui。按,默认情况下,使用模块中全局设置的0.1秒暂停: def press(keys, presses=1, interval=0.0, pause=None, logScreenshot=None

我正在为10fastfingers.com编写一个自动打字机器人。它起作用了

我正在使用pytesseract库查找文本,然后使用pyautogui按键。 我知道pyautogui.press并没有这么快

我发现类似pyautoguide.press的东西,但速度很快。 像

研究剧本
pyautogui。按
,默认情况下,使用模块中全局设置的0.1秒
暂停

def press(keys, presses=1, interval=0.0, pause=None, logScreenshot=None, _pause=True):
    """Performs a keyboard key press down, followed by a release.
    ...
    ...
    _autoPause(pause, _pause)
_自动暂停:

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)
和暂停:

PAUSE = 0.1 # The number of seconds to pause after EVERY public function call. Useful for debugging.
如您所见,如果“暂停在<代码>中按是<代码>无,则默认情况下,它会恢复为0.1秒<代码>暂停

您可以通过设置较低的暂停速率来覆盖它
pyautogui。按(c,暂停=0.05)

PAUSE = 0.1 # The number of seconds to pause after EVERY public function call. Useful for debugging.