Python library for automating Windows
Project description
autoxkit
一个轻量级的 Windows 自动化库,支持前后台键鼠操作、前后台图色识别、全局hook监听等功能。适用于自动化脚本、软件测试、人机交互等多种场景。
✨ 功能特色
- ✅ 前后台键鼠操作
- ✅ 前后台图色识别
- ✅ 文本输入模拟
- ✅ 全局鼠标和键盘hook监听
- ✅ 简洁的事件回调机制,便于集成和扩展
- ✅ 完全基于 Python 实现,易于上手和二次开发
📦 安装方式
从 PyPI 安装:
pip install autoxkit
或下载源码后本地安装:
pip install .
🔧 使用示例
"""
return Any or not return 只监听事件,不阻止事件传播
return True 监听事件,并阻止事件传播,可以理解为下一个窗口不会收到该事件
"""
from autoxkit.mousekey 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 许可证开源,欢迎使用与二次开发。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
autoxkit-0.9.0.tar.gz
(38.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
autoxkit-0.9.0-py3-none-any.whl
(43.3 kB
view details)
File details
Details for the file autoxkit-0.9.0.tar.gz.
File metadata
- Download URL: autoxkit-0.9.0.tar.gz
- Upload date:
- Size: 38.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6beb04873724ea496f38e098e3a85384294099ed55e594fc97f00e59de6c45ff
|
|
| MD5 |
c2345b5f37650e910f06d79f43a8b6f7
|
|
| BLAKE2b-256 |
4d1573e1c2f9af73cffada2d985c9faaccce16f75c9f61be6c2a64c17586bb73
|
File details
Details for the file autoxkit-0.9.0-py3-none-any.whl.
File metadata
- Download URL: autoxkit-0.9.0-py3-none-any.whl
- Upload date:
- Size: 43.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38b8eba522c5b1bc989ddd7189a03a17f46d99e3315ff82e99665341b11ad1a5
|
|
| MD5 |
a4e07f51ae313568682f02ff67c0698d
|
|
| BLAKE2b-256 |
2a5ecd8df0064fbac1968348fe1212a1ba0ca0013232a2e003104d3cb8a9b59f
|