简体   繁体   English

在Linux中记录所有鼠标单击和键盘事件[Python]

[英]Recording all mouse click and keyboard events in linux [Python]

I need a function that when will return true or false depending on whether a mouse event was recorded. 我需要一个函数,该函数何时返回truefalse取决于是否记录了鼠标事件。 Right now I'm using python-Xlib to record cursor positions, but the amount of documentation for the module is really sparse. 现在,我正在使用python-Xlib记录光标位置,但是该模块的文档数量确实很少。 It seems the only way to get familiar with it is to dig through the source code. 似乎熟悉它的唯一方法是深入研究源代码。

I'm not talking about keeping track of a gui being pressed or anything like that, I need raw input from the mouse. 我不是在谈论跟踪gui的按下或类似操作,我需要鼠标的原始输入。

Check out pyHook . 查看pyHook

It handles tons of events at relatively low-level (Windows Only). 它以相对较低的级别处理大量事件(仅Windows)。

If you need examples, you'll find a lot of projects around the web, such as this one 如果您需要示例,则可以在网上找到很多项目,例如这个

If you are on Linux, there is also pyxhook 如果您使用的是Linux,则还有pyxhook

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM