當前位置: 首頁>>代碼示例>>Python>>正文


Python keyboard.Controller方法代碼示例

本文整理匯總了Python中pynput.keyboard.Controller方法的典型用法代碼示例。如果您正苦於以下問題:Python keyboard.Controller方法的具體用法?Python keyboard.Controller怎麽用?Python keyboard.Controller使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pynput.keyboard的用法示例。


在下文中一共展示了keyboard.Controller方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: enter_input

# 需要導入模塊: from pynput import keyboard [as 別名]
# 或者: from pynput.keyboard import Controller [as 別名]
def enter_input():
    if PYINPUT:
        keyboard = Controller()
        keyboard.press(Key.enter)
        keyboard.release(Key.enter) 
開發者ID:ElevenPaths,項目名稱:ibombshell,代碼行數:7,代碼來源:listener.py

示例2: load_instructions

# 需要導入模塊: from pynput import keyboard [as 別名]
# 或者: from pynput.keyboard import Controller [as 別名]
def load_instructions(f):
    keyboard = Controller()
    sleep(1)
    data_file = open(f)
    for line in data_file.readlines():
        keyboard.type(line + "\n")
        sleep(0.2) 
開發者ID:ElevenPaths,項目名稱:ibombshell,代碼行數:9,代碼來源:ibombshell.py

示例3: click

# 需要導入模塊: from pynput import keyboard [as 別名]
# 或者: from pynput.keyboard import Controller [as 別名]
def click(x, y):
    mouse.press(Button.left)
    return

# Keyboard: 
開發者ID:ardamavi,項目名稱:Game-Bot,代碼行數:7,代碼來源:game_control.py

示例4: _key_change_callback

# 需要導入模塊: from pynput import keyboard [as 別名]
# 或者: from pynput.keyboard import Controller [as 別名]
def _key_change_callback(deck_id: str, _deck: StreamDeck.StreamDeck, key: int, state: bool) -> None:
    if state:
        keyboard = Controller()
        page = get_page(deck_id)

        command = get_button_command(deck_id, page, key)
        if command:
            Popen(command.split(" "))

        keys = get_button_keys(deck_id, page, key)
        if keys:
            keys = keys.strip().replace(" ", "")
            for section in keys.split(","):
                for key_name in section.split("+"):
                    keyboard.press(getattr(Key, key_name.lower(), key_name))
                for key_name in section.split("+"):
                    keyboard.release(getattr(Key, key_name.lower(), key_name))

        write = get_button_write(deck_id, page, key)
        if write:
            keyboard.type(write)

        brightness_change = get_button_change_brightness(deck_id, page, key)
        if brightness_change:
            change_brightness(deck_id, brightness_change)

        switch_page = get_button_switch_page(deck_id, page, key)
        if switch_page:
            set_page(deck_id, switch_page - 1) 
開發者ID:timothycrosley,項目名稱:streamdeck-ui,代碼行數:31,代碼來源:api.py

示例5: __init__

# 需要導入模塊: from pynput import keyboard [as 別名]
# 或者: from pynput.keyboard import Controller [as 別名]
def __init__(self, addr=DEFAULT_ADDR):
        self.reactor = None
        self.addr = addr
        self.running = False
        self.root = None
        self.keyboard = Controller() 
開發者ID:AirtestProject,項目名稱:Poco,代碼行數:8,代碼來源:OSXUI.py

示例6: __init__

# 需要導入模塊: from pynput import keyboard [as 別名]
# 或者: from pynput.keyboard import Controller [as 別名]
def __init__(self):
        self.keyboard = Controller() 
開發者ID:CedArctic,項目名稱:Chimera,代碼行數:4,代碼來源:input_commands.py


注:本文中的pynput.keyboard.Controller方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。