On Sat, Nov 21, 2009 at 9:00 PM, claudio canepa <[email protected]> wrote:

>
> On Sat, Nov 21, 2009 at 2:37 PM, gurkesaft <[email protected]> wrote:
>
>> Hello,
>>
>> I'm using pyglet 1.1.3 on windows XP, python2.6. In deriving a class
>> with Window() as a base, I noticed that overriding the on_key_release
>> () did not seem to work. None of the code in this method would run
>> when I released a key, while on_key_press() worked fine.
>>
>> From the command line, it seems pretty clear:
>>
>> >>> import pyglet
>> >>> w = pyglet.window.Window()
>>
>> Then typing
>>
>> >>> w.on_key_press
>>
>> gives the result
>>
>> <bound method Win32Window.on_key_press of
>> <pyglet.window.win32.Win32Window object at 0x03328EB0>>
>>
>> and typing
>>
>> >>> w.on_key_release
>>
>> gives the result
>>
>> AttributeError: 'Win32Window' object has no attribute 'on_key_release'
>>
>> While typing, auto-complete also shows me that on_key_release is not
>> in the list. So it seems I don't have access to the on_key_release,
>> but it is in the documentation.
>>
>> Anyone else experiencing this?
>>
>> Regards,
>> Jack
>>
>
> I see the same, but it is fine:
> 1. run the sample events.py found in the examples directory ( pyglet doc
> and examples package), you will see that pyglet knows about key release
> events.
>
> 2. try this simple script:
>
> import pyglet
> window = pyglet.window.Window()
> @window.event
> def on_key_release(key, modifiers):
>   print 'released'
> pyglet.app.run()
>
> it will show that the key release events hit the on_key_release defined in
> the script.
>

To expand on that, the only reason that pyglet.window.Window has an
attribute 'on_key_pressed', is that it contains a default handler for key
down events (quits if the ESC key is pressed).

-- 
Tristam MacDonald
http://swiftcoder.wordpress.com/

--

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=.


Reply via email to