Python pyglet.window.key.TAB Examples

The following are 9 code examples of pyglet.window.key.TAB(). 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: CONTENT_VALIGN_CENTER.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):
        super(TestWindow, self).on_key_press(symbol, modifiers)
        if symbol == key.TAB:
            self.caret.on_text('\t') 
Example #2
Source File: CONTENT_VALIGN_BOTTOM.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):
        super(TestWindow, self).on_key_press(symbol, modifiers)
        if symbol == key.TAB:
            self.caret.on_text('\t') 
Example #3
Source File: STYLE.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):
        super(TestWindow, self).on_key_press(symbol, modifiers)
        if symbol == key.TAB:
            self.caret.on_text('\t') 
Example #4
Source File: PLAIN.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):
        super(TestWindow, self).on_key_press(symbol, modifiers)
        if symbol == key.TAB:
            self.caret.on_text('\t') 
Example #5
Source File: test_style.py    From pyglet with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def on_key_press(self, symbol, modifiers):
        super(TestWindow, self).on_key_press(symbol, modifiers)
        if symbol == key.TAB:
            self.caret.on_text('\t') 
Example #6
Source File: test_plain.py    From pyglet with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def on_key_press(self, symbol, modifiers):
        super(TestWindow, self).on_key_press(symbol, modifiers)
        if symbol == key.TAB:
            self.caret.on_text('\t') 
Example #7
Source File: test_multiline_wrap.py    From pyglet with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def on_key_press(self, symbol, modifiers):
        super(TestWindow, self).on_key_press(symbol, modifiers)
        if symbol == key.TAB:
            self.caret.on_text('\t') 
Example #8
Source File: test_content_valign.py    From pyglet with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def on_key_press(self, symbol, modifiers):
        super(TestWindow, self).on_key_press(symbol, modifiers)
        if symbol == key.TAB:
            self.caret.on_text('\t') 
Example #9
Source File: scenes.py    From TerraCraft with GNU General Public License v3.0 4 votes vote down vote up
def on_key_press(self, symbol, modifiers):
        """Event handler for the Window.on_key_press event.

        Called when the player presses a key. See pyglet docs for key
        mappings.

        Parameters
        ----------
        symbol : int
            Number representing the key that was pressed.
        modifiers : int
            Number representing any modifying keys that were pressed.

        """
        if symbol == key.W:
            self.strafe[0] -= 1
        elif symbol == key.S:
            self.strafe[0] += 1
        elif symbol == key.A:
            self.strafe[1] -= 1
        elif symbol == key.D:
            self.strafe[1] += 1
        elif symbol == key.SPACE:
            if self.flying:
                # Reduces vertical flying speed
                # 0.1 positive value that allows vertical flight up.
                self.dy = 0.1 * JUMP_SPEED
            elif self.dy == 0:
                self.dy = JUMP_SPEED
                self.audio.play(self.jump_sfx)
        elif symbol == key.LCTRL:
            self.running = True
        elif symbol == key.LSHIFT:
            if self.flying:
                # Reduces vertical flying speed
                # -0.1 negative value that allows vertical flight down.
                self.dy = -0.1 * JUMP_SPEED
            elif self.dy == 0:
                self.dy = JUMP_SPEED
        elif symbol == key.ESCAPE:
            self.set_exclusive_mouse(False)
            return pyglet.event.EVENT_HANDLED
        elif symbol == key.TAB:
            self.flying = not self.flying
        elif symbol == key.F1:
            self.scene_manager.change_scene("HelpScene")
        elif symbol == key.F2:
            self.toggleGui = not self.toggleGui
        elif symbol == key.F3:
            self.toggleLabel = not self.toggleLabel
        elif symbol == key.F5:
            self.scene_manager.save.save_world(self.model)
        elif symbol == key.F12:
            pyglet.image.get_buffer_manager().get_color_buffer().save('screenshot.png')
        elif symbol in self.num_keys:
            index = (symbol - self.num_keys[0]) % len(self.inventory)
            self.block = self.inventory[index]
        elif symbol == key.ENTER:
            self.scene_manager.change_scene('MenuScene')