Python pyglet.window.key.E Examples

The following are 5 code examples of pyglet.window.key.E(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pyglet.window.key , or try the search function .
Example #1
Source File: WINDOW_SET_EXCLUSIVE_KEYBOARD.py    From flappy-bird-py with GNU General Public License v2.0 5 votes vote down vote up
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 
Example #2
Source File: WINDOW_SET_EXCLUSIVE_MOUSE.py    From flappy-bird-py with GNU General Public License v2.0 5 votes vote down vote up
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 
Example #3
Source File: test_window_settings.py    From pyglet with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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) 
Example #4
Source File: test_window_settings.py    From pyglet with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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) 
Example #5
Source File: player_agent.py    From playground with Apache License 2.0 5 votes vote down vote up
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 = {}