Hi all,
I am trying to attach functions to the numbers on the top of the
keyboard with an accelerator table, but I cannot find the names of the
number keys. I found the F keys, the Numpad keys, and the Special keys
(whatever they are) but nothing about the regular keys above the
letters on the standard American keyboard. I tried WXK_One and WXK_1,
but neither worked. I also tried WXK_SPECIAL1, but that also failed.
Thanks in advance for any info. I know it is just something simple,
but I cannot find it, even in the list of key names at wxpython.org.
Hi all,
I am trying to attach functions to the numbers on the top of the
keyboard with an accelerator table, but I cannot find the names of the
number keys. I found the F keys, the Numpad keys, and the Special keys
(whatever they are) but nothing about the regular keys above the
letters on the standard American keyboard. I tried WXK_One and WXK_1,
but neither worked. I also tried WXK_SPECIAL1, but that also failed.
Thanks in advance for any info. I know it is just something simple,
but I cannot find it, even in the list of key names at wxpython.org.
They are probably like the regular keyboard letter keys where you need
to check the char code.
1 key == ord('1')
2 key == ord('2')
etc...
Can't say I remember trying this before but this is how I would expect
it to work.
Cody
···
On Thu, Aug 5, 2010 at 9:51 AM, Alex Hall <mehgcap@gmail.com> wrote:
Hi all,
I am trying to attach functions to the numbers on the top of the
keyboard with an accelerator table, but I cannot find the names of the
number keys. I found the F keys, the Numpad keys, and the Special keys
(whatever they are) but nothing about the regular keys above the
letters on the standard American keyboard. I tried WXK_One and WXK_1,
but neither worked. I also tried WXK_SPECIAL1, but that also failed.
Thanks in advance for any info. I know it is just something simple,
but I cannot find it, even in the list of key names at wxpython.org.
--
Have a great day,
Alex (msg sent from GMail website)
There are no special WXK codes. The key to finding the answer was the
wxPython Demo. They have a handy KeyEvents demo in there in the
"Process and Events" section. Anyway, in your key event handler, do
something like this:
That ugly code is only needed for the demo because of all the other stuff it is doing there. As Cody mentioned the key code for normal alphanumeric keys on the keyboard is simply the ASCII value of the character.
···
On 8/5/10 8:08 AM, Mike Driscoll wrote:
Hi Alex,
On Aug 5, 9:51 am, Alex Hall<mehg...@gmail.com> wrote:
Hi all,
I am trying to attach functions to the numbers on the top of the
keyboard with an accelerator table, but I cannot find the names of the
number keys. I found the F keys, the Numpad keys, and the Special keys
(whatever they are) but nothing about the regular keys above the
letters on the standard American keyboard. I tried WXK_One and WXK_1,
but neither worked. I also tried WXK_SPECIAL1, but that also failed.
Thanks in advance for any info. I know it is just something simple,
but I cannot find it, even in the list of key names at wxpython.org.
--
Have a great day,
Alex (msg sent from GMail website)
There are no special WXK codes. The key to finding the answer was the
wxPython Demo. They have a handy KeyEvents demo in there in the
"Process and Events" section. Anyway, in your key event handler, do
something like this:
OK. Cody's answer must have come in while I was digging in the demo
since it wasn't there when I started my dumb reply. Listen to these
guys, Alex! Ignore my erroneous advice!!!
···
On Aug 5, 11:03 am, Robin Dunn <ro...@alldunn.com> wrote:
On 8/5/10 8:08 AM, Mike Driscoll wrote:
> Hi Alex,
> On Aug 5, 9:51 am, Alex Hall<mehg...@gmail.com> wrote:
>> Hi all,
>> I am trying to attach functions to the numbers on the top of the
>> keyboard with an accelerator table, but I cannot find the names of the
>> number keys. I found the F keys, the Numpad keys, and the Special keys
>> (whatever they are) but nothing about the regular keys above the
>> letters on the standard American keyboard. I tried WXK_One and WXK_1,
>> but neither worked. I also tried WXK_SPECIAL1, but that also failed.
>> Thanks in advance for any info. I know it is just something simple,
>> but I cannot find it, even in the list of key names at wxpython.org.
>> --
>> Have a great day,
>> Alex (msg sent from GMail website)
> There are no special WXK codes. The key to finding the answer was the
> wxPython Demo. They have a handy KeyEvents demo in there in the
> "Process and Events" section. Anyway, in your key event handler, do
> something like this:
That ugly code is only needed for the demo because of all the other
stuff it is doing there. As Cody mentioned the key code for normal
alphanumeric keys on the keyboard is simply the ASCII value of the
character.
--
Robin Dunn
Software Craftsmanhttp://wxPython.org
It's been a while since I've mentioned it, so I should also say that the key code sent to the KEY_DOWN/KEY_UP events is a "raw" value for the key that has not had any modifiers, international keyboard maps, or input method editor functionality applied to it. If the key down events are *not* Skip()ed then after one or more key down events a EVT_CHAR event will be generated where the GetKeyCode and/or GetUnicodeKey is the "cooked" value, IOW the character that has had the modifiers/etc. applied to it.
Mike mentioned the KeyEvents sample in the demo. I recommend that everybody who doesn't fully understand what I wrote above should play with that sample until you do.
···
On 8/5/10 9:03 AM, Robin Dunn wrote:
That ugly code is only needed for the demo because of all the other
stuff it is doing there. As Cody mentioned the key code for normal
alphanumeric keys on the keyboard is simply the ASCII value of the
character.