Hi there, Happy New Year all.
I've noticed that pressing the Alt key hangs my Pyglet application.
Specifically, the hang occurs right after the window.on_key_release
event. Clock scheduled updates and screen refreshes seem to stop happening.
The application starts updating again if ALT is pressed again, or if the
mouse cursor is clicked on the window. Pressing any other key also
unhangs it, with an MSWindows error beep.
Attached is a minimal pyglet application that demonstrates the behaviour
on my machine.
Is there a way to stop this from happening?
I'm on Windows XP. This doesn't happen if my application is fullscreen,
it only happens in windowed mode.
I'm guessing that this is related to the way the ALT key in Windows lets
users use the keyboard to navigate pull-down menus. Windows is
suspending all events to my application while it waits for me to
navigate the pull down menus (and there aren't any pull down menus -
it's a typical pyglet.window.Window.)
I've tried a couple of wild guesses at workarounds, such as setting
exclusive keyboard for the application's window, or else returning
EVENT_HANDLED from the on_key_press or on_key_release handlers, but they
don't seem to help.
Best regards,
Jonathan
--
Jonathan Hartley Made of meat. http://tartley.com
[email protected] +44 7737 062 225 twitter/skype: tartley
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en.
#!/usr/bin/python
import random
from pyglet import app, clock
from pyglet.event import EVENT_HANDLED
from pyglet.window import Window
win = None
def on_draw():
print 'draw', random.randint(0, 10)
win.clear()
def update(_):
print 'update', random.randint(0, 10)
def on_key_press(symbol, modifiers):
print 'key press', symbol, modifiers
def on_key_release(symbol, modifiers):
print 'key release', symbol, modifiers
return EVENT_HANDLED
win = Window(fullscreen=False)
win.on_draw = on_draw
win.on_key_press = on_key_press
win.on_key_release = on_key_release
clock.schedule(update)
app.run()