I'm using Pyhook for a major project. Thank you for your effort for having created such a useful and convenient tool in Python.
Currently I'm able to tell if a key down event is Alt-modified by checking the value of event.Alt, is there a way to tell if it is Ctrl-modified, Shift-modified, or Win-modified, it seems in the event class construct, there is no indication of which modifiers are used except Alt.
My program is able to differentiate the events 'Ctrl+a' and 'a' because they have diff Ascii value, but 'Ctrl + space' and 'space' look totally same. Likewise 'Shift + Numpad+' and 'Numpad+' look totally same.
A workaround would be to check the key in the previous keyboard event. But this workaround is unable to tell the difference between 'Ctrl followed by a' and 'a modified by Ctrl'
Regards
W.J.F.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
pyhook exposes the windows API, and the windows events only have the "alt" modifier as an attribute.
to keep track of the other modifiers, you basically have to hook the keydown and the keyup, and maintain a dictionary with which keys are in the "pressed" condition.
hope this helps!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm using Pyhook for a major project. Thank you for your effort for having created such a useful and convenient tool in Python.
Currently I'm able to tell if a key down event is Alt-modified by checking the value of event.Alt, is there a way to tell if it is Ctrl-modified, Shift-modified, or Win-modified, it seems in the event class construct, there is no indication of which modifiers are used except Alt.
My program is able to differentiate the events 'Ctrl+a' and 'a' because they have diff Ascii value, but 'Ctrl + space' and 'space' look totally same. Likewise 'Shift + Numpad+' and 'Numpad+' look totally same.
A workaround would be to check the key in the previous keyboard event. But this workaround is unable to tell the difference between 'Ctrl followed by a' and 'a modified by Ctrl'
Regards
W.J.F.
Hi,
pyhook exposes the windows API, and the windows events only have the "alt" modifier as an attribute.
to keep track of the other modifiers, you basically have to hook the keydown and the keyup, and maintain a dictionary with which keys are in the "pressed" condition.
hope this helps!