本文整理汇总了Python中pyglet.window.key.E属性的典型用法代码示例。如果您正苦于以下问题:Python key.E属性的具体用法?Python key.E怎么用?Python key.E使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类pyglet.window.key
的用法示例。
在下文中一共展示了key.E属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_key_press
# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import E [as 别名]
def on_key_press(self, symbol, modifiers):
print 'Pressed %s with modifiers %s' % \
(key.symbol_string(symbol), key.modifiers_string(modifiers))
if symbol == key.E:
exclusive = not (modifiers & key.MOD_SHIFT)
self.w.set_exclusive_keyboard(exclusive)
print 'Exclusive keyboard is now %r' % exclusive
示例2: on_key_press
# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import E [as 别名]
def on_key_press(self, symbol, modifiers):
if symbol == key.E:
exclusive = not (modifiers & key.MOD_SHIFT)
self.w.set_exclusive_mouse(exclusive)
print 'Exclusive mouse is now %r' % exclusive
示例3: on_key_press
# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import E [as 别名]
def on_key_press(self, symbol, modifiers):
print('Pressed %s with modifiers %s' % \
(key.symbol_string(symbol), key.modifiers_string(modifiers)))
if symbol == key.E:
exclusive = not (modifiers & key.MOD_SHIFT)
self.w.set_exclusive_keyboard(exclusive)
print('Exclusive keyboard is now %r' % exclusive)
示例4: __init__
# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import E [as 别名]
def __init__(self, character=characters.Bomber, agent_control='arrows'):
super(PlayerAgent, self).__init__(character)
##
# @NOTE: DO NOT move this import outside the constructor. It will
# not work in headless environments like a Docker container
# and prevents Pommerman from running.
#
from pyglet.window import key
controls = {
'arrows': {
key.UP: 1,
key.DOWN: 2,
key.LEFT: 3,
key.RIGHT: 4,
key.SPACE: 5,
key.M: 6 # In Pommerman, this will freeze the game.
},
'wasd': {
key.W: 1,
key.S: 2,
key.A: 3,
key.D: 4,
key.E: 5,
key.Q: 6 # In Pommerman, this will freeze the game.
}
}
assert agent_control in controls, "Unknown control: {}".format(
agent_control)
self._key2act = controls[agent_control]
self._action_q = []
self._keystate = {}