0

I'm making a python app that triggers an action when the print screen key is pressed. I'm using pyhook library. However, every time I press a character written with the language of my country (ãíé and others) is doubling the characters . For example : ~~a ''e ''i , causing problems in the normal user written use. Is there any way to fix ?

user3553966
  • 319
  • 1
  • 3
  • 7

2 Answers2

0

Suggested method: use pygame module instead of pythoncom for pump events

hooks_manager = pyHook.HookManager()
hooks_manager.KeyDown = OnKeyboardEvent
hooks_manager.HookKeyboard()
# Dont use pythoncom.PumpMessages()

pygame.init()
while True:
    pygame.event.pump()

Old method: try to change preferred language and switch it back (just toggle), it may help.

For ex:

  • Add one more language pack (not keyboard layout, input type same)
  • Change preferred language
  • Switch back to old one (that you are using)
  • Switch back again if doesn't work
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
yEmreAk.com
  • 3,278
  • 2
  • 18
  • 37
-1

try to add this line:

# -* - coding: utf-8 -* -

ertugrul
  • 9
  • 5