本文实例讲述了Python实现监控键盘鼠标操作。分享给大家供大家参考,具体如下:
# -*- coding: utf-8 -*-
import pythoncom
import pyHook
import time
def onMouseEvent(event):
"处理鼠标事件"
fobj.writelines('-' * 20 + 'MouseEvent Begin' + '-' * 20 + '\n')
fobj.writelines("Current Time:%s\n" % time.strftime("%a, %d %b %Y %H:%M:%S", time.gmti
1