本文整理汇总了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)
示例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)
示例3: click
# 需要导入模块: from pynput import keyboard [as 别名]
# 或者: from pynput.keyboard import Controller [as 别名]
def click(x, y):
mouse.press(Button.left)
return
# Keyboard:
示例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)
示例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()
示例6: __init__
# 需要导入模块: from pynput import keyboard [as 别名]
# 或者: from pynput.keyboard import Controller [as 别名]
def __init__(self):
self.keyboard = Controller()