本文整理汇总了Python中pykeyboard.PyKeyboard方法的典型用法代码示例。如果您正苦于以下问题:Python pykeyboard.PyKeyboard方法的具体用法?Python pykeyboard.PyKeyboard怎么用?Python pykeyboard.PyKeyboard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pykeyboard
的用法示例。
在下文中一共展示了pykeyboard.PyKeyboard方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import pykeyboard [as 别名]
# 或者: from pykeyboard import PyKeyboard [as 别名]
def __init__(self, name):
self.wname = name #Name of the game window
self.sv = ScreenViewer() #For getting screens of the game
self.mm = MovementMap() #Bot's internal map of the world
self.ts = TargetingSystem(m = 7, n = 9, ss = (800, 600), sb = (4, 0, 4, 12), cp = (400, 274), train = False)
self.m = PyMouse() #PyMouse object for triggering mouse input
self.k = PyKeyboard() #For triggering keyboard
self.pm = ProjMap(800, 600) #Convert between 3d and 2d coords
self.p = None #The current path of the bot
self.cpi = 0 #Current potion index
self.hp = None #Home position
self.lwbp = False #LW Button press occurred
self.lwmoved = 0 #LW movement state
self.state = Const.EVAD0 #State of bot
self.tla = 0
self.lwts = 0
示例2: execute_all_generic_libraries_with_keyboard_only
# 需要导入模块: import pykeyboard [as 别名]
# 或者: from pykeyboard import PyKeyboard [as 别名]
def execute_all_generic_libraries_with_keyboard_only(gui):
menubar_ctrl = gui.singletons.main_window_controller.menu_bar_controller
gui(
menubar_ctrl.on_open_activate, None, None,
testing_utils.get_test_sm_path(os.path.join("unit_test_state_machines", "all_generic_libraries"))
)
testing_utils.wait_for_gui()
gui(menubar_ctrl.on_start_activate, None, None)
import time
from pykeyboard import PyKeyboard
time.sleep(0.5)
k = PyKeyboard()
k.tap_key('Return', 7, 0.5)
k.tap_key('Tab', 2, 0.5)
k.tap_key('Return', 5, 0.5)
gui(menubar_ctrl.on_stop_activate, None, None)
示例3: _get_keyboard
# 需要导入模块: import pykeyboard [as 别名]
# 或者: from pykeyboard import PyKeyboard [as 别名]
def _get_keyboard():
# noinspection PyPackageRequirements
from pykeyboard import PyKeyboard
return PyKeyboard()
示例4: __init__
# 需要导入模块: import pykeyboard [as 别名]
# 或者: from pykeyboard import PyKeyboard [as 别名]
def __init__(self):
"""Creates an instance of `YoutubeControl`."""
self._keyboard = PyKeyboard()
self._command_lookup = {
"left": self._keyboard.left_key,
"right": self._keyboard.right_key,
"up": self._keyboard.up_key,
"down": self._keyboard.down_key,
"shift": self._keyboard.shift_key
}