pyglet.window.key

Key constants and utilities for pyglet.window.

Usage:

from pyglet.window import Window
from pyglet.window import key

window = Window()

@window.event
def on_key_press(symbol, modifiers):
    # Symbolic names:
    if symbol == key.RETURN:

    # Alphabet keys:
    elif symbol == key.Z:

    # Number keys:
    elif symbol == key._1:

    # Number keypad keys:
    elif symbol == key.NUM_1:

    # Modifiers:
    if modifiers & key.MOD_CTRL:

Classes

KeyStateHandler Simple handler that tracks the state of keys on the keyboard.

Functions

modifiers_string(modifiers) Return a string describing a set of modifiers.
motion_string(motion) Return a string describing a text motion.
symbol_string(symbol) Return a string describing a key symbol.
user_key(scancode) Return a key symbol for a key not supported by pyglet.

Table Of Contents

Previous topic

WindowExitHandler Class

Next topic

KeyStateHandler Class