Skip to main content

autoxkit

PyPI version Python Version License

一个轻量级的 python 自动化库,支持 Windows 前后台键鼠操作、图像识别、全局 hook 监听等,Android 模块基于 scrcpy-server v4.0 协议支持 Android 无线/有线投屏、键鼠映射等功能。 适用于自动化脚本、软件测试、人机交互等多种场景。


功能特色

  • 前后台键鼠操作
  • 前后台图像识别
  • 文本输入模拟
  • 全局键鼠 hook 监听
  • Android 无线/有线投屏
  • Android 键鼠映射

Android 模块依赖于 scrcpy v4.0 ,请自行前往 scrcpy v4.0 下载 scrcpy-win64-v4.0.zip 文件。


安装方式

从 PyPI 安装:

pip install autoxkit

或下载源码后本地安装:

pip install .

示例代码

"""
return Any or not return 只监听事件,不阻止事件传播

return True 监听事件,并阻止事件传播,可以理解为下一个窗口不会收到该事件
"""

from autoxkit.hook import HookListener, KeyEvent, MouseEvent

def key_down(event: KeyEvent):
    print(event.action, event.key_code, event.key_name)
    if event.key_name == 'A':
        print("A键将被阻止传播,其他窗口将无法接收到该事件")
        return True
    return False

def key_up(event: KeyEvent):
    print(event.action, event.key_code, event.key_name)
    return False

def mouse_down(event: MouseEvent):
    print(event.action, event.button, event.position)
    return False

def mouse_up(event: MouseEvent):
    print(event.action, event.button, event.position)
    return False


hook_listener = HookListener()
hook_listener.add_handler('keydown', key_down)
hook_listener.add_handler('keyup', key_up)
hook_listener.add_handler('mousedown', mouse_down)
hook_listener.add_handler('mouseup', mouse_up)
hook_listener.start()

print("当前鼠标位置:", hook_listener.get_mouse_position())

if __name__ == '__main__':
    try:
        hook_listener.wait()
    except Exception:
        hook_listener.stop()

更多示例代码请参考 examples


GitHub 项目地址

https://github.com/YorickFin/autoxkit


License

本项目基于 GPL-3.0 许可开源,欢迎使用与二次开发。

Metadata

Release files for autoxkit 2.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for autoxkit 2.5.3
File Size Uploaded Provenance Actions
autoxkit-2.5.3.tar.gz 72.9 kB Without provenance Details for autoxkit-2.5.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for autoxkit 2.5.3
File Interpreter ABI Platform Actions
autoxkit-2.5.3-py3-none-any.whl Python 3 none any Details for autoxkit-2.5.3-py3-none-any.whl

Total release size: 147.1 kB

Release files / autoxkit-2.5.3.tar.gz

Download URL autoxkit-2.5.3.tar.gz
Size 72.9 kB
Tags Source
SHA-256 checksum
How to use checksums
11fcabf10e1ba447e3096b1afec203f1376c32d7e218f0d98584a7785073d911
BLAKE2b-256 checksum
How to use checksums
2554d736295ea4a198a322f9511c41336ffb298c62a9d60788586626436e512f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.18

Release files / autoxkit-2.5.3-py3-none-any.whl

Download URL autoxkit-2.5.3-py3-none-any.whl
Size 74.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c8b02970ff8cf666ed9c90e6dc7f7bbd1ad6491d8c8dce7269072b700c2f508
BLAKE2b-256 checksum
How to use checksums
9d6da0913f491f551f4a9de8b328dac28f72a7111c6f24d2f0e38ab92aba9e70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.18

Security for autoxkit 2.5.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.5.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page