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


Python key.E屬性代碼示例

本文整理匯總了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 
開發者ID:shrimpboyho,項目名稱:flappy-bird-py,代碼行數:10,代碼來源:WINDOW_SET_EXCLUSIVE_KEYBOARD.py

示例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 
開發者ID:shrimpboyho,項目名稱:flappy-bird-py,代碼行數:7,代碼來源:WINDOW_SET_EXCLUSIVE_MOUSE.py

示例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) 
開發者ID:pyglet,項目名稱:pyglet,代碼行數:10,代碼來源:test_window_settings.py

示例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 = {} 
開發者ID:MultiAgentLearning,項目名稱:playground,代碼行數:36,代碼來源:player_agent.py


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