pyHook is a python wrapper for global input hooks in Windows. Specifically it wraps the Windows SetWindowsHookEx API function using low-level keyboard (WH_KEYBOARD_LL) and mouse (WH_MOUSE_LL) hooks.
Questions tagged [pyhook]
202 questions
23
votes
7 answers
ImportError: No module named pywintypes
I am working to make a small keylogger with Python, by using the pyHook, pythoncom and Pywin32 modules. Here is my code:
import pyHook, pythoncom, sys, logging
file_log = 'C:\\important\\log.txt'
def OnKeyboardEvent (event):
…

Eden Pigram
- 349
- 1
- 3
- 7
14
votes
4 answers
PyHook doesn't detect key pressed in some windows
I ran this PyHook sample code:
import pythoncom, pyHook
def OnKeyboardEvent(event):
print 'MessageName:',event.MessageName
print 'Message:',event.Message
print 'Time:',event.Time
print 'Window:',event.Window
print…

badprogrammerqq
- 167
- 7
12
votes
4 answers
pythoncom crashes on KeyDown when used hooked to certain applications
I wrote this code on to observe the event of a keydown motion. The problem appears to be that when this script is run, certain programs will crash this program, spitting out this error message:
TypeError: KeyboardSwitch() missing 8 required…

Kevin
- 121
- 1
- 4
9
votes
2 answers
PyHook on python 3.5
I am trying to write a basic keylogging program on python. I need to install the pywin32 and pyhook modules. I have managed to get pywin32 installed, but cannot seem to pyhook to work. I have read its possible to get it to work on later versions of…

Vladamir
- 247
- 1
- 3
- 11
8
votes
2 answers
time.sleep requires integers?
I'm writing a macro that will click certain spots on the screen when I press a key.
The first time I press a key, everything runs fine.
However, any other key press results in the error:
time.sleep(0.1)
TypeError: an integer is required
Here…

Anti Earth
- 4,671
- 13
- 52
- 83
8
votes
2 answers
How do I use my own loop with pyhook instead of pumpMessages()?
I'm trying to use pyhooks to detect mouse clicks anywhere on screen. The problem is that I can only get it to work with PumpMessages(). I'd like it operate inside of a while loop that I've constructed. Is there a way to accomplish this/why does it…

Zack
- 4,177
- 8
- 34
- 52
6
votes
1 answer
import pyHook failed
I Have installed pyHook for my windows 64 bit.The setup has installed it in C:\Python27\Lib\site-packages dir i cant import pyhook (i can see win32 named folder there think so it is its folder) in my code what should i do
Here is interpreters…

Danny Rock
- 89
- 1
- 2
- 12
5
votes
2 answers
How can I avoid TypeError: MouseSwitch() missing 8 required positional arguments: 'msg', 'x', 'y', 'data', 'time', 'hwnd', and 'window_name'
Trying to hook into mouse events but in my early tests the program stops responding after about 30 seconds[EDIT: See bottom of post] and gives this error
TypeError: MouseSwitch() missing 8 required positional arguments: 'msg', 'x', 'y', 'data',…

DerpoMarx
- 59
- 1
- 3
5
votes
2 answers
pyHook for Python 3.3
I am coding a simple keylogger using Python. I hope to use pyHook to capture keyboard events.I couldn't find any packages of pyHook for python 3.3 which I have installed. Is there any other module for python 3.3 which provides similar…

Deepal
- 1,729
- 5
- 24
- 34
5
votes
1 answer
Python win32api.mouse_event TypeError
import sys
import win32api, win32con
import pyHook
import pythoncom
def CursorLeft():
win32api.mouse_event(win32con.MOUSEEVENTF_MOVE, -1, 0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)
…

Junkah
- 51
- 1
- 3
4
votes
2 answers
Can't install pyHook package "Could not find a version that satisfies the requirement pyHook"
im trying to install the pyHook package in pycharm but get the error in the title. I have successfully installed it in cmd with pip install pyHook-1.5.1-cp37-cp37m-win_amd64.whl ,but when I go to install it in pycharm I get the aforementioned error…

NotaPowVirgin
- 69
- 1
- 7
4
votes
1 answer
How to create heatmap in Python using OSMnx and a list of values corresponding to the graph's nodes?
I've built a simulation model of pedestrians walking on a network using OSMnx and one of the simulation's outputs is a list "Visits" that is corresponding to the nodes in NodesList = list(Graph.nodes).
How can I create an heatmap using those lists…

Guy
- 41
- 3
4
votes
3 answers
Block pyhook from so-generated keystrokes?
I'm using pyhook and pyhk to map keystrokes on a windows XP machine, and it works fine except for when the keystroke (say, ctrl+z) already exists in the application. In that case, the ctrl+z passes to the application and triggers the action that has…

reckoner
- 2,861
- 3
- 33
- 43
4
votes
2 answers
Something like pyHook on OS X
I am actually working with pyHook, but I'd like to write my program for OS X too.
If someone know such a module ... I've been looking on the internet for a while, but nothing really relevant.
-> The idea is to be able to record keystrokes outside…

Carto_
- 577
- 8
- 28
3
votes
2 answers
Trouble installing and importing pyHook
This is my first question on this site so I hope I format this correctly. I also am very new to programming so bear with my lack of knowledge, thank you!
I'm trying to install pyHook like so and I keep getting this error message:
C:\Python27>py -2.7…
user8960617