Odd behavior with on_key_press

Issue #145 resolved
marcus543211
created an issue

Sometimes when pressing more buttons at the same time, some of them aren't registered before others are released, and sometimes they aren't registered at all.

Broken combinations: Left, up, down A, S, D, F, G

Script used for testing:

import pyglet

window = pyglet.window.Window()

@window.event()
def on_key_press(symbol, modifier):
    print("Key pressed:", pyglet.window.key.symbol_string(symbol))

@window.event()
def on_key_release(symbol, modifier):
    print("Key released:", pyglet.window.key.symbol_string(symbol))

pyglet.app.run()

python -m pyglet.info: https://docs.google.com/document/d/1dnG1qbC0icSVeuAOPbTatRyFEiyTfQ1e9jTRgnIWlcI/edit?usp=sharing

Comments (4)

  1. ccanepa

    Not a pyglet developer, but this defect normally comes from limitations in the keyboard hardware.

    This is a direct consequence of how the electrical matrix of switches is wired, which depends in the manufacturer and model.

    Typically it is safe to assume that three simultaneous keys presses will be correctly handled; high end keyboards can handle much more.

  2. Log in to comment