Python pyautogui 模块,keyDown() 实例源码

我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用pyautogui.keyDown()

项目:base_function    作者:Rockyzsu    | 项目源码 | 文件源码
def example():
    screenWidth, screenHeight = pg.size()
    currentMouseX, currentMouseY = pg.position()
    pg.moveTo(500, 550)
    pg.click()
    pg.moveRel(None, 10)  # move mouse 10 pixels down
    pg.doubleClick()
    # pg.moveTo(500, 500, duration=2, tween=pyautogui.tweens.easeInOutQuad)  # use tweening/easing function to move mouse over 2 seconds.
    pg.typewrite('Hello world!', interval=0.25)  # type with quarter-second pause in between each key
    pg.press('esc')
    pg.keyDown('shift')
    pg.press(['left', 'left', 'left', 'left', 'left', 'left'])
    pg.keyUp('shift')
    pg.hotkey('ctrl', 'c')
    delta_y = 50
项目:Nightchord    作者:theriley106    | 项目源码 | 文件源码
def applyChain(file):
    p = subprocess.Popen(["audacity", "./{}".format(file)])
    time.sleep(7)
    try:
        pyautogui.click(pyautogui.locateCenterOnScreen('src/images/discard.png'))
        time.sleep(1)
        pyautogui.click(pyautogui.locateCenterOnScreen('src/images/yes.png'))
    except:
        pass

    time.sleep(1)
    if len(list(pyautogui.locateAllOnScreen('src/images/audacity_fileButton.png'))) > 1:
        pyautogui.keyDown('alt')
        pyautogui.press('f10')
        pyautogui.keyUp('alt')
    time.sleep(1)
    pyautogui.click(pyautogui.locateCenterOnScreen('src/images/audacity_fileButton.png'))
    time.sleep(2)
    pyautogui.click(pyautogui.locateCenterOnScreen('src/images/audacity_applyChain.png'))
    time.sleep(2)
    pyautogui.click(pyautogui.locateCenterOnScreen('src/images/audacity_applyToCurrentFile.png'))
    time.sleep(10)
    p.terminate()
    print('Done')
项目:skill-autogui    作者:eClarity    | 项目源码 | 文件源码
def handle_select_combination_intent(self, message):
        self.speak("Selecting all")
        pyautogui.hotkey("ctrl", "a")
        if message.data.get("PasteKeyword"):
            self.handle_paste_intent(message)
        elif message.data.get("CopyKeyword"):
            self.handle_copy_intent(message)
        elif message.data.get("CutKeyword"):
            self.handle_cut_intent(message)
        elif message.data.get("DeleteKeyword"):
            self.speak("deleting")
            pyautogui.keyDown("delete")
            pyautogui.keyUp("delete")
项目:Nightchord    作者:theriley106    | 项目源码 | 文件源码
def maxWindow():
    try:
        pyautogui.click(pyautogui.locateCenterOnScreen('src/images/discard.png'))
        time.sleep(1)
        pyautogui.click(pyautogui.locateCenterOnScreen('src/images/yes.png'))
    except:
        pass

    time.sleep(1)
    if len(list(pyautogui.locateAllOnScreen('src/images/audacity_fileButton.png'))) > 1:
        pyautogui.keyDown('alt')
        pyautogui.press('f10')
        pyautogui.keyUp('alt')
项目:Controller-Hand    作者:ardamavi    | 项目源码 | 文件源码
def press():
    pyautogui.keyDown('space')
项目:gmail-generator    作者:unix121    | 项目源码 | 文件源码
def locate_gmail():

    #Sleep for a while and wait for Firefox to open
    time.sleep(2)

    # Printing message
    msg(1,'Opening Gmail...')

    # Typing the website on the browser
    pyautogui.keyDown('ctrlleft');  pyautogui.typewrite('a'); pyautogui.keyUp('ctrlleft')
    pyautogui.typewrite('https://accounts.google.com/SignUp?service=mail&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&ltmpl=default')
    pyautogui.typewrite('\n')

    # Wait for a while until the website responds
    time.sleep(3)

    # Print a simple message
    msg(1,'Locating the form...')

    # Locate the form
    _gmail_=pyautogui.locateOnScreen('images/gmail_form.png')
    _form_=pyautogui.center(_gmail_)

    # Check and print message
    if not pyautogui.click(_form_):
        msg(1,'Located the form.')
    else:
        msg(3,'Failed to locate the form.')
        ext()


# Function used to randomize credentials
项目:skill-autogui    作者:eClarity    | 项目源码 | 文件源码
def handle_press_key_intent(self, message):
        key = message.data.get('Key')
        self.speak("Pressing %s" % key)
        pyautogui.keyDown(key)
        pyautogui.keyUp(key)
项目:skill-autogui    作者:eClarity    | 项目源码 | 文件源码
def handle_hold_key_intent(self, message):
        key = message.data.get('Key')
        self.speak("Holding down %s key" % key)
        pyautogui.keyDown(key)
项目:osrmacro    作者:jjvilm    | 项目源码 | 文件源码
def type_this(strings):
    """Types the passed characters with random pauses in between strokes"""
    for s in strings:
        # delay between key presses--key UP/DOWN
        #autopy.key.toggle(s, True)
        pyautogui.keyDown(s)
        RandTime.randTime(0,0,0,0,0,9)
        pyautogui.keyUp(s)
        # delay after key UP--next key