take over control of mouse/keyboard - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: take over control of mouse/keyboard (/thread-15000.html) |
take over control of mouse/keyboard - ian - Dec-29-2018 My script periodically needs to control mouse/keyboard to do things for a few seconds then give the control back to user. This script just disable them, not what I want. Please advise. Thanks. import pythoncom, pyHook def uMad(event): return False hm = pyHook.HookManager() hm.MouseAll = uMad hm.KeyAll = uMad hm.HookMouse() hm.HookKeyboard() pythoncom.PumpMessages() RE: take over control of mouse/keyboard - Larz60+ - Dec-29-2018 Not sure this is what you're looking for, but think so for keyboard see: https://pypi.org/project/keyboard/ for mouse see: https://pypi.org/project/mouse/ |