Some time ago I started using pyHook to handle events. However, the original version has errors, so I changed it to an alternate version that corrected the errors of the original version. However, I have found that this alternate version always shows an empty string for the method that returns the name of the window that is in focus.
from pyHook import HookManager
from python import PumpMessages
def evento_teclado(event):
print(event.WindowName())
return True
hm=HookManager()
hm.KeyDown=evento_teclado
hm.HookKeyboard()
PumpMessages()
This script always shows an empty string. Is there any other way to get the window name?