How to make keyboard events ignoring keyboad layout?

Is there a way to use the keyboard witouth minding wich key is in which place?

I have a program which uses the first two rows of the keyboard, I have a QWERTY keyboard, but a French for example will have an AZERTY one, so instead of the first 2 rows will have some usefull keys in the third row and some useless keys in the first row.

I hope I have explained the problem, I guess this should have an easy way to fix it, but I don’t seem to find any solution on the web.

Thanks in advance.

I’ll answer myself, in case someother sumbles upon this.

You could ignore the actual keys, if you use EVT_CAR_HOOK and event.Skip at the end of the call instead of EVT_KEY_DOWN
So my code now is:

# self.videopanel.Bind(wx.EVT_KEY_DOWN, self.on_key_down)
self.videopanel.Bind(wx.EVT_CHAR_HOOK, self.on_key_down)
def on_key_down(self, event):
    global dual, midsection, To_pause, Hash, first, key
    try:
        if key:
            # keycode = event.GetKeyCode()
            keycode = event.GetRawKeyCode()
         '''CODE....CODE'''
    event.Skip()

···

El martes, 3 de mayo de 2016, 13:32:33 (UTC+2), Marcos del Amo escribió:

Is there a way to use the keyboard witouth minding wich key is in which place?

I have a program which uses the first two rows of the keyboard, I have a QWERTY keyboard, but a French for example will have an AZERTY one, so instead of the first 2 rows will have some usefull keys in the third row and some useless keys in the first row.

I hope I have explained the problem, I guess this should have an easy way to fix it, but I don’t seem to find any solution on the web.

Thanks in advance.

Shit I’km wrong…I tested it wrongly -.- Back in square one

···

El martes, 3 de mayo de 2016, 13:32:33 (UTC+2), Marcos del Amo escribió:

Is there a way to use the keyboard witouth minding wich key is in which place?

I have a program which uses the first two rows of the keyboard, I have a QWERTY keyboard, but a French for example will have an AZERTY one, so instead of the first 2 rows will have some usefull keys in the third row and some useless keys in the first row.

I hope I have explained the problem, I guess this should have an easy way to fix it, but I don’t seem to find any solution on the web.

Thanks in advance.

Marcos del Amo wrote:

Shit I'km wrong...I tested it wrongly -.- Back in square one

    Is there a way to use the keyboard witouth minding wich key is in
    which place?

    I have a program which uses the first two rows of the keyboard, I
    have a QWERTY keyboard, but a French for example will have an AZERTY
    one, so instead of the first 2 rows will have some usefull keys in
    the third row and some useless keys in the first row.

    I hope I have explained the problem, I guess this should have an
    easy way to fix it, but I don't seem to find any solution on the web.

This is one way to think about it: The EVT_KEY_* events give you the "raw" key event, and EVT_CHAR gives you the "cooked" value. The raw keys are dependent on the keyboard and keyboard layout. The cooked keys are the raw values after they have passed though the OS and any keymaps, input method editors, and key compositing (when multiple keystrokes are used to make one character) that may be defined for the keyboard and locale.

···

El martes, 3 de mayo de 2016, 13:32:33 (UTC+2), Marcos del Amo escribió:

--
Robin Dunn
Software Craftsman

So if I’m not mistaken using the AZERTY and QWERTY keyboard, the “raw value” of the american and french keyboard would be the same, but the cooked key value would be ‘A’ and ‘Q’.

So I need to get the raw key codes and search for those instead of the letter.

If that’s it I read about the Raw value but failed in truly understand it’s meaning.

Thank’s for your response, when I saw your name as the one answering my question I was like: wow Robin Dunn answering MY question!!

···

El miércoles, 4 de mayo de 2016, 21:33:44 (UTC+2), Robin Dunn escribió:

Marcos del Amo wrote:

Shit I’km wrong…I tested it wrongly -.- Back in square one

El martes, 3 de mayo de 2016, 13:32:33 (UTC+2), Marcos del Amo escribió:

Is there a way to use the keyboard witouth minding wich key is in
which place?
I have a program which uses the first two rows of the keyboard, I
have a QWERTY keyboard, but a French for example will have an AZERTY
one, so instead of the first 2 rows will have some usefull keys in
the third row and some useless keys in the first row.
I hope I have explained the problem, I guess this should have an
easy way to fix it, but I don't seem to find any solution on the web.

This is one way to think about it: The EVT_KEY_* events give you the
“raw” key event, and EVT_CHAR gives you the “cooked” value. The raw
keys are dependent on the keyboard and keyboard layout. The cooked keys
are the raw values after they have passed though the OS and any keymaps,
input method editors, and key compositing (when multiple keystrokes are
used to make one character) that may be defined for the keyboard and locale.


Robin Dunn

Software Craftsman

http://wxPython.org