Python pyglet.window.key.X Examples

The following are 11 code examples of pyglet.window.key.X(). 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_MINIMIZE_MAXIMIZE.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.X:
            self.w.maximize()
            print 'Window maximized.'
        elif symbol == key.N:
            self.w.minimize()
            print 'Window minimized.' 
Example #2
Source File: WINDOW_SET_SIZE.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):
        delta = 20
        if modifiers & key.MOD_SHIFT:
            delta = -delta
        if symbol == key.X:
            self.width += delta
        elif symbol == key.Y:
            self.height += delta
        self.w.set_size(self.width, self.height)
        print 'Window size set to %dx%d.' % (self.width, self.height) 
Example #3
Source File: WINDOW_SET_MIN_MAX_SIZE.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.N:
            self.w.set_minimum_size(self.width, self.height)
            print 'Minimum size set to %dx%d.' % (self.width, self.height)
        elif symbol == key.X:
            self.w.set_maximum_size(self.width, self.height)
            print 'Maximum size set to %dx%d.' % (self.width, self.height) 
Example #4
Source File: WINDOW_FIXED_SET_SIZE.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):
        delta = 20
        if modifiers & key.MOD_SHIFT:
            delta = -delta
        if symbol == key.X:
            self.width += delta
        elif symbol == key.Y:
            self.height += delta
        self.w.set_size(self.width, self.height)
        print 'Window size set to %dx%d.' % (self.width, self.height) 
Example #5
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.N:
            self.w.set_minimum_size(self.width, self.height)
            print('Minimum size set to %dx%d.' % (self.width, self.height))
        elif symbol == key.X:
            self.w.set_maximum_size(self.width, self.height)
            print('Maximum size set to %dx%d.' % (self.width, self.height)) 
Example #6
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):
        delta = 20
        if modifiers & key.MOD_SHIFT:
            delta = -delta
        if symbol == key.X:
            self.width += delta
        elif symbol == key.Y:
            self.height += delta
        self.w.set_size(self.width, self.height)
        print('Window size set to %dx%d.' % (self.width, self.height)) 
Example #7
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):
        delta = 20
        if modifiers & key.MOD_SHIFT:
            delta = -delta
        if symbol == key.X:
            self.width += delta
        elif symbol == key.Y:
            self.height += delta
        self.w.set_size(self.width, self.height)
        print('Window size set to %dx%d.' % (self.width, self.height)) 
Example #8
Source File: test_window_events.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.X:
            self._select_next_key() 
Example #9
Source File: test_window_events.py    From pyglet with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def _update_question(self):
        self.question = """Please press:

{} ({})


Press the X key if you do not have this motion key.
Press Esc if test does not pass.""".format(key.motion_string(self.chosen_key),
                                           key.symbol_string(self.chosen_key))
        self._render_question() 
Example #10
Source File: test_window_events.py    From pyglet with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def _update_question(self):
        self.question = """Please hold <Shift> and press:

{} ({})


Press the X key if you do not have this motion key.
Press Esc if test does not pass.""".format(key.motion_string(self.chosen_key),
                                           key.symbol_string(self.chosen_key))
        self._render_question() 
Example #11
Source File: test_window_events.py    From pyglet with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_show_hide(self):
        """Test the on_show and on_hide events."""
        self.question = ('Please trigger hide and show this window again.\n'
                         'You can do this by:\n'
                         '- Minimize and restore the window\n'
                         '- On OS X show and hide using Command+H or the dock context menu\n'
                         '\n'
                         'Test passes after doing this 4 times.')
        self.window_size = 700, 200
        self._test_main()