Python如何讀取鼠標點擊坐標?
讀取鼠標點擊坐標,包括點下去和抬起來的坐標,注意不要在命令行點,可能會出問題
import pythoncom, pyHook
def onMouseEvent(event):
print "Position:", event.Position
return True
def main():
hm = pyHook.HookManager()
hm.HookKeyboard()
hm.MouseAllButtonsDown = onMouseEvent
hm.MouseAllButtonsUp = onMouseEvent
hm.HookMouse()
pythoncom.PumpMessages()
if __name__ == "__main__":
main()
上一篇python能做什么