当前位置: 首页>>代码示例>>Python>>正文


Python pyautogui.keyDown方法代码示例

本文整理汇总了Python中pyautogui.keyDown方法的典型用法代码示例。如果您正苦于以下问题:Python pyautogui.keyDown方法的具体用法?Python pyautogui.keyDown怎么用?Python pyautogui.keyDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyautogui的用法示例。


在下文中一共展示了pyautogui.keyDown方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: type_with_keys_down

# 需要导入模块: import pyautogui [as 别名]
# 或者: from pyautogui import keyDown [as 别名]
def type_with_keys_down(self, text, *keys):
        '''Press keyboard keys down, then write given text, then release the
        keyboard keys.

        See valid keyboard keys in `Press Combination`.

        Examples:

        | Type with keys down | write this in caps  | Key.Shift |
        '''
        valid_keys = self._validate_keys(keys)
        for key in valid_keys:
            ag.keyDown(key)
        ag.typewrite(text)
        for key in valid_keys:
            ag.keyUp(key) 
开发者ID:eficode,项目名称:robotframework-imagehorizonlibrary,代码行数:18,代码来源:_keyboard.py

示例2: press

# 需要导入模块: import pyautogui [as 别名]
# 或者: from pyautogui import keyDown [as 别名]
def press(key):
    # keyboard_controller.press(key)
    pyautogui.keyDown(key) 
开发者ID:nimaid,项目名称:LPHK,代码行数:5,代码来源:keyboard_unix.py

示例3: locate_gmail

# 需要导入模块: import pyautogui [as 别名]
# 或者: from pyautogui import keyDown [as 别名]
def locate_gmail():
    
    #Sleep for a while and wait for Firefox to open
    time.sleep(3)

    # 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(6)

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

    # Locate the form
    pyautogui.press('tab')
 
    time.sleep(2)

    _gmail_ = pyautogui.locateOnScreen('images/gmail_form.png')
    formx, formy = pyautogui.center(_gmail_)
    pyautogui.click(formx, formy)
    
    # Check and print message
    if not pyautogui.click(formx, formy):
        msg(1,'Located the form.')
    else:
        msg(3,'Failed to locate the form.')
        ext()


# Function used to randomize credentials 
开发者ID:unix121,项目名称:gmail-generator,代码行数:39,代码来源:gmail_generator.py

示例4: key_down

# 需要导入模块: import pyautogui [as 别名]
# 或者: from pyautogui import keyDown [as 别名]
def key_down(key):
        """Performs a keyboard key press without the release. This will put that key in a held down state.

        :param key: The key to be pressed down.
        :return: None.
        """
        if isinstance(key, Key):
            pyautogui.keyDown(key.value.label)
        elif isinstance(key, str):
            if pyautogui.isValidKey(key):
                pyautogui.keyDown(key)
            else:
                raise ValueError("Unsupported Key input.")
        else:
            raise ValueError("Unsupported Key input.") 
开发者ID:mozilla,项目名称:iris,代码行数:17,代码来源:keyboard.py

示例5: do_work

# 需要导入模块: import pyautogui [as 别名]
# 或者: from pyautogui import keyDown [as 别名]
def do_work(self):
        pyautogui.keyDown('s')
        time.sleep(1)
        pyautogui.keyUp('s')
        pyautogui.keyDown('s')
        time.sleep(1)
        pyautogui.keyUp('s')
        pyautogui.keyDown('s')
        time.sleep(1)
        pyautogui.keyUp('s')
        pyautogui.keyDown('s')
        time.sleep(1)
        pyautogui.keyUp('s')
        print('Zoomed out.')
        self.next() 
开发者ID:Sunuba,项目名称:roc,代码行数:17,代码来源:Commands.py


注:本文中的pyautogui.keyDown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。