Hi!
I want to know how to obtain the ascii code from a wxKeyEvent of a
pressed key.
Adrian T.
Hi!
I want to know how to obtain the ascii code from a wxKeyEvent of a
pressed key.
Adrian T.
Hi Adrian,
On Wednesday, April 25, 2012 1:38:56 PM UTC-5, tarniadi wrote:
Hi!
I want to know how to obtain the ascii code from a wxKeyEvent of a
pressed key.
Adrian T.
I have an example in my tutorial on KeyEvents: wxPython: Catching Key and Char Events - Mouse Vs Python
They “key” is in the onKeyPress event handler: event.GetKeyCode()
That should get you what you’re looking for.
I have an example in my tutorial on KeyEvents:wxPython: Catching Key and Char Events - Mouse Vs Python…
- Mike
Oh wow! Thanks for reminding me of that tut. I just reread it and saw
the part about CTRL+K+Y. That helps a little. But how do you get a
continious stream of key down events for two or more keys continually
depressed such as A+W or W+D? It seems only the first depressed and
held-down key sends events. I was also wondering when you press and
hold a key down how is it that games ignore that repeat-key-down-delay
(a setting in the BIOS) and if that's possible to ignore it, the delay
that is, in wxPython?
Sadly, that goes beyond my knowledge of wx. Hopefully Robin will be able to tell us how that part works. I’m guessing that in your code, you just watch for repeated events coming from specific key codes and just ignore them, but I don’t really know.
On Friday, April 27, 2012 7:50:26 AM UTC-5, DevPlayer wrote:
I have an example in my tutorial on KeyEvents:http://www.blog.pythonlibrary.org/2009/08/29/wxpython-catching-key-an.…
- Mike
Oh wow! Thanks for reminding me of that tut. I just reread it and saw
the part about CTRL+K+Y. That helps a little. But how do you get a
continious stream of key down events for two or more keys continually
depressed such as A+W or W+D? It seems only the first depressed and
held-down key sends events. I was also wondering when you press and
hold a key down how is it that games ignore that repeat-key-down-delay
(a setting in the BIOS) and if that’s possible to ignore it, the delay
that is, in wxPython?
Did you check out the KeyEvents wxPython demo? If I keep a key down I see multiple events for it in that demo.
Werner
On 27/04/2012 14:50, DevPlayer wrote:
I have an example in my tutorial on KeyEvents:wxPython: Catching Key and Char Events - Mouse Vs Python…
- MikeOh wow! Thanks for reminding me of that tut. I just reread it and saw
the part about CTRL+K+Y. That helps a little. But how do you get a
continious stream of key down events for two or more keys continually
depressed such as A+W or W+D? It seems only the first depressed and
held-down key sends events. I was also wondering when you press and
hold a key down how is it that games ignore that repeat-key-down-delay
(a setting in the BIOS) and if that's possible to ignore it, the delay
that is, in wxPython?
I think that is usually done by keeping track of the state of keys. IOW, setting a flag when the first key-down for a key arrives, and clearing the flag when the key-up happens. Then the application reacts to the change in state, not to each key event.
On 4/27/12 5:50 AM, DevPlayer wrote:
I have an example in my tutorial on KeyEvents:http://www.blog.pythonlibrary.org/2009/08/29/wxpython-catching-key-an…
- MikeOh wow! Thanks for reminding me of that tut. I just reread it and saw
the part about CTRL+K+Y. That helps a little. But how do you get a
continious stream of key down events for two or more keys continually
depressed such as A+W or W+D? It seems only the first depressed and
held-down key sends events. I was also wondering when you press and
hold a key down how is it that games ignore that repeat-key-down-delay
(a setting in the BIOS) and if that's possible to ignore it, the delay
that is, in wxPython?
--
Robin Dunn
Software Craftsman
I think that is usually done by keeping track of the state of keys.
IOW, setting a flag when the first key-down for a key arrives, and
clearing the flag when the key-up happens. Then the application reacts
to the change in state, not to each key event.Robin Dunn
Ah! Thanks for the direction;