Using the following code to disable my mouse and keyboard for 10 seconds. I'm still able to move my mouse and keyboard while the code is running. also I want to call this function from another script in python but I'm not able to. Any suggestions?
import pythoncom, pyHook, time
start = time.time()
time.perf_counter
elapsed = 0
def windoow(event):
global elapsed
if elapsed < 10:
elapsed = time.time() - start
time.sleep(1)
return False
return True
hm = pyHook.HookManager()
hm.MouseAll = windoow
hm.KeyAll = windoow
hm.HookMouse()
hm.HookKeyboard()
pythoncom.PumpMessages()