Python pyglet.window.key.PAGEDOWN Examples

The following are 2 code examples of pyglet.window.key.PAGEDOWN(). 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.py    From flappy-bird-py with GNU General Public License v2.0 6 votes vote down vote up
def on_key_release(symbol, modifiers):
    global player

    global bigScreen
    global smallScreen

    if symbol == key.SPACE:
        player.jump()

    if symbol == key.PAGEUP:
        if smallScreen == True:
                glScalef(2.0, 2.0, 2.0)
                window.set_size(window.width * 2, window.height * 2)
                smallScreen = False
                bigScreen = True
    if symbol == key.PAGEDOWN:
            if bigScreen:
                glScalef(0.5, 0.5, 0.5)
                window.set_size(window.width / 2 , window.height /2)
                smallScreen = True
                bigScreen = False

# Handle mouse presses 
Example #2
Source File: manual_control.py    From gym-miniworld with Apache License 2.0 5 votes vote down vote up
def on_key_press(symbol, modifiers):
    """
    This handler processes keyboard commands that
    control the simulation
    """

    if symbol == key.BACKSPACE or symbol == key.SLASH:
        print('RESET')
        env.reset()
        env.render('pyglet', view=view_mode)
        return

    if symbol == key.ESCAPE:
        env.close()
        sys.exit(0)

    if symbol == key.UP:
        step(env.actions.move_forward)
    elif symbol == key.DOWN:
        step(env.actions.move_back)

    elif symbol == key.LEFT:
        step(env.actions.turn_left)
    elif symbol == key.RIGHT:
        step(env.actions.turn_right)

    elif symbol == key.PAGEUP or symbol == key.P:
        step(env.actions.pickup)
    elif symbol == key.PAGEDOWN or symbol == key.D:
        step(env.actions.drop)

    elif symbol == key.ENTER:
        step(env.actions.done)