Python3.6的死板简单跨平台键盘和鼠标全局输入捕获解决方案+
sneakysnek的Python项目详细描述
sneakysnek是python 3.6+的一个极简的跨平台全局输入捕获解决方案。虽然输入库的
术语中已经提供了一些功能,但它们通常更关注发送输入,
捕获只是事后的考虑。`` sneakysnek``在设计和最终使用方面都非常简单。您将在不到5行的代码中启动并运行
,并将开始在所有3个受支持的平台(Linux、Windows、MacOS)上接收精益&;
通用事件。
此库的构建目的是为“serpent.ai
框架<;https://github.com/serpentai/serpentai>中的游戏录制功能提供动力;`_在这里,键盘和鼠标输入与帧序列一起收集,以构建机器学习数据集。
image0
将在MacOS上安装“pyobjc framework quartz”,在Linux上安装“python xlib”。
demo
----
一旦安装到python环境中,您就可以在平台上快速旋转测试它。只需运行“sneakysnek”。
代码::python
from sneakysnek.recorder import recorder
在大多数情况下,它不应该留下任何东西。为了达到最佳清洁度,
完成录制后,从主线程运行``recorder.stop()`。
events
----
>为录制器提供的回调将接收以下两个事件对象中的一个:
keyboardevent
~~~~~~~~~~~
键盘。
**属性**
-*事件*:其中一个“keyboardevents.down”、“keyboardevents.up”`
-*键盘键*:来自“keyboard key
枚举的一个项<;https://github.com/serpentai/sneakysnek/blob/master/sneakysnek/keyboard-keys.py>;`_
-*timestamp*:timestamp
mouse event
~~~~~~~~~~~~
表示从鼠标捕获的事件。
**attributes**
-*event*:mouseevent之一。单击``。`` mouse events.scroll`,
``mouseevents.move`
-*button*:mousebutton
枚举中的一个条目<;https://github.com/serpentai/sneakysnek/blob/master/sneakysnek/mouse-button.py>;` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `1在macos上)
-*x*:表示鼠标位置x坐标的整数
-*y*:表示鼠标位置y坐标的整数
-*timestamp*:a``time.time()`` timestamp
==
太棒了!更多内容,请随时访问:
>
>-了解更多关于毒蛇(serpent.ai>;`http://serpent.ai>;`http://serpent.ai>;`http://www.serpent.saperpent.ai>;`http://www.serpent.serpent.ai>;`http://blog.serpent.ai>;`-
`repo<;https://github.com/serpentai/serpentai/serpentai>;`http://www.github.com/serpentai/serpentai/serpentai>;`http://www.twitch.twitch.twitch.twitch.tv/serpent/serpent是的`_&;
`youtube<;https://www.youtube.com/c/serpent ai>;`\uu
-在“twitter”上跟随serpent.ai<;https://twitter.com/serpent\u ai>;`\uuu
<;3
~
……|图片0图片::https://s3.ca-central-1.amazonaws.com/serpent ai assets/sneakysnek.gif
术语中已经提供了一些功能,但它们通常更关注发送输入,
捕获只是事后的考虑。`` sneakysnek``在设计和最终使用方面都非常简单。您将在不到5行的代码中启动并运行
,并将开始在所有3个受支持的平台(Linux、Windows、MacOS)上接收精益&;
通用事件。
此库的构建目的是为“serpent.ai
框架<;https://github.com/serpentai/serpentai>中的游戏录制功能提供动力;`_在这里,键盘和鼠标输入与帧序列一起收集,以构建机器学习数据集。
image0
将在MacOS上安装“pyobjc framework quartz”,在Linux上安装“python xlib”。
demo
----
一旦安装到python环境中,您就可以在平台上快速旋转测试它。只需运行“sneakysnek”。
代码::python
from sneakysnek.recorder import recorder
完成录制后,从主线程运行``recorder.stop()`。
events
----
>为录制器提供的回调将接收以下两个事件对象中的一个:
keyboardevent
~~~~~~~~~~~
键盘。
**属性**
-*事件*:其中一个“keyboardevents.down”、“keyboardevents.up”`
-*键盘键*:来自“keyboard key
枚举的一个项<;https://github.com/serpentai/sneakysnek/blob/master/sneakysnek/keyboard-keys.py>;`_
-*timestamp*:timestamp
mouse event
~~~~~~~~~~~~
表示从鼠标捕获的事件。
**attributes**
-*event*:mouseevent之一。单击``。`` mouse events.scroll`,
``mouseevents.move`
-*button*:mousebutton
枚举中的一个条目<;https://github.com/serpentai/sneakysnek/blob/master/sneakysnek/mouse-button.py>;` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `1在macos上)
-*x*:表示鼠标位置x坐标的整数
-*y*:表示鼠标位置y坐标的整数
-*timestamp*:a``time.time()`` timestamp
==
太棒了!更多内容,请随时访问:
>
>-了解更多关于毒蛇(serpent.ai>;`http://serpent.ai>;`http://serpent.ai>;`http://www.serpent.saperpent.ai>;`http://www.serpent.serpent.ai>;`http://blog.serpent.ai>;`-
`repo<;https://github.com/serpentai/serpentai/serpentai>;`http://www.github.com/serpentai/serpentai/serpentai>;`http://www.twitch.twitch.twitch.twitch.tv/serpent/serpent是的`_&;
`youtube<;https://www.youtube.com/c/serpent ai>;`\uu
-在“twitter”上跟随serpent.ai<;https://twitter.com/serpent\u ai>;`\uuu
<;3
~
……|图片0图片::https://s3.ca-central-1.amazonaws.com/serpent ai assets/sneakysnek.gif