#2 Problem with accents (french locale)

open
nobody
None
5
2014-10-27
2012-09-25
No

Hello,

Using Windows 8 x64, Python 2.7 x64 and pyHook 1.5.1 x64 (found here, "Base distribution" : http://www.lfd.uci.edu/~gohlke/pythonlibs/ )

I am encountering some problems with pyHook using a french AZERTY keyboard. It seems that I can't properly use '^' accents when pyHook is running.

Let's consider this script :

def on_key_down(event):
print event.Key

import pyHook
hook_manager = pyHook.HookManager()
hook_manager.KeyDown = on_key_down
hook_manager.HookKeyboard()

import pygtk
pygtk.require('2.0')
import gtk
gtk.main()
==========

If I launch this script, when I press this on my keyboard : '^' - 'a' - '^' - 'a' - '^' - 'a'
The script prints this :
=============
Oem_6
A
Oem_6
A
Oem_6
A
=============
And it writes this in an opened notepad window : ^^a^^a^^a
But it should print : âââ

It would be nice if pyHook didn't forbid me to write 'â' :).

Thanks for your work on pyHook btw.

Discussion

  • francois

    francois - 2014-02-19

    I confirm having the exact same problem.

    Anyway to work around it? (and thanks for Pyhook :) )

     
  • Klahnen

    Klahnen - 2014-10-13

    Hi,

    It also happens with spanish accents isntead of 'á' it is writting '´´a'.

    I propose myself to correct this bug, I just need a hint for where to start, because I am not familiar with pyhook source code.

     
  • Milan Herbig

    Milan Herbig - 2014-10-27

    Hi, I found this bug today. I also have non-english keyboard, czech keyboard concretely. I am unable to write chars like é, ě, ü, etc. All I get is doubled accents and diacritics. So I spent rest of the day to find out why and I may have a solution.

    First I found this thread:
    http://www.experts-exchange.com/Programming/Microsoft_Development/Q_23453780.html

    With proposed enhancement I was able to write non-Shift chars like é, ö, but not chars ě (needs hold shift key).

    Finally I found this post:
    http://stackoverflow.com/questions/1964614/toascii-tounicode-in-a-keyboard-hook-destroys-dead-keys

    I've tried to implement ToUnicode (somehow) and it works. But I am not C++ programmer at all, lowlevel win32 programming is nightmare for me, but I hope it will work.

    Here is attached .zip file with modified cpyHook.i file. Please, feel free to try this and let us know, if it works on yout keyboard too. Thanks

     
    • munkhbymba

      munkhbymba - 2017-05-14

      Hi, i can't understand. Please give me more details Milan Herbig

       
      • Milan Herbig

        Milan Herbig - 2017-05-18

        Hi, what is it you can't understand. It's a long time a struggled with this. I actually left a pyhook implementation and used pure Python implementation using ctypes and user32.dll library. You can find my hook for global keyboard shortcuts listening here https://github.com/m1lhaus/woofer/blob/master/components/winkeyhook.py

         

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks