本文整理匯總了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
}