Skip to main content

Python library for automating Windows

Project description

autoxkit

PyPI version Python Version License

一个轻量级的 Windows 自动化库,支持鼠标与键盘操作模拟、全局钩子监听、事件回调机制等功能。适用于自动化脚本、软件测试、人机交互等多种场景。


✨ 功能特色

  • ✅ 全局鼠标和键盘钩子监听
  • ✅ 支持鼠标点击、移动、滚轮等操作
  • ✅ 支持按键按下、释放、文本输入等模拟
  • ✅ 简洁的事件回调机制,便于集成和扩展
  • ✅ 完全基于 Python 实现,易于上手和二次开发

📦 安装方式

从 PyPI 安装:

pip install autoxkit

或下载源码后本地安装:

pip install .

🔧 使用示例

import time
from autoxkit.mousekey import HookListener, KeyEvent, MouseEvent

def key_down(event: KeyEvent):
    print('keydown', event.key_name)

def key_up(event: KeyEvent):
    print('keyup', event.key_name)

def mouse_down(event: MouseEvent):
    print('mousedown', event.button, event.position)

def mouse_up(event: MouseEvent):
    print('mouseup', event.button, event.position)


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()

if __name__ == '__main__':
    print("当前鼠标位置:", hook_listener.get_mouse_position())
    print("HookListener 正在运行... 按 Ctrl+C 退出")

    try:
        while True:
            time.sleep(1)
    except Exception:
        hook_listener.stop()

更多示例请参考:examples


📁 GitHub 项目地址

👉 https://github.com/YorickFin/autoxkit


📃 License

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

Project details


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.2.1.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autoxkit-0.2.1-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

File details

Details for the file autoxkit-0.2.1.tar.gz.

File metadata

  • Download URL: autoxkit-0.2.1.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for autoxkit-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8438ca639e4ecc80e4f0729cbe6824f83514ad2135db86e54432ce65db2606b6
MD5 bccb6ada25dc1e299e9b001e65dc4e56
BLAKE2b-256 5d530606ef35746fb4519271eef6c2c4f015dc2724af94abc63736113afd5202

See more details on using hashes here.

File details

Details for the file autoxkit-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: autoxkit-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 24.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for autoxkit-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4c65982b278cdfbe3b97c07cef59205a7082c095a263997768100a310eed00c6
MD5 1402e56f6738a521e402e3f3b44d1949
BLAKE2b-256 bd41caa5d20040575255e416b9b971521bf27b971f85a63bd5b893e479f22d87

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page