event-simulate


Nameevent-simulate JSON
Version 1.1.2 PyPI version JSON
download
home_pagehttps://github.com/qfcy/Python/tree/main/event
Summary模拟键盘,鼠标事件的Python包。可用于编写自动化程序 (如游戏外挂)。A Python package simulating keyboard and mouse events ,which can be used in automation programs.
upload_time2024-01-09 12:05:05
maintainer
docs_urlNone
author七分诚意 qq:3076711200
requires_python
license
keywords event simulate key mouse click automation 键盘 鼠标 外挂
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            模块名称: event (切勿使用import event_simulate) !

简介
====

event-simulate是一个模拟键盘,鼠标事件的Python包, 可以模拟鼠标单击、双击, 键盘按下等各种操作,

打包成PyInstaller等exe文件时体积小巧。可用于编写自动化程序 (如游戏外挂等)。


所包含模块 Included modules: 
============================

event.key - 模拟键盘事件
""""""""""""""""""""""""
包含的函数 Functions:

keydown(keycode_or_keyname)::

    模拟键按下。
    keycode_or_keyname:按键名称或该按键的键码值

keypress(keycode_or_keyname, delay=0.05)::

    模拟按键。
    keycode_or_keyname:按键名称或该按键的键码值
    delay:键按下与释放之间的的间隔时间,间隔时间越小,按键速度越快。

keyup(keycode_or_keyname)::

    模拟键释放。
    keycode_or_keyname:按键名称或该按键的键码值


event.mouse - 模拟鼠标事件
""""""""""""""""""""""""""
包含的函数 Functions:

click()::

    模拟鼠标左键单击

dblclick(delay=0.25)::

    模拟鼠标左键双击

get_screensize()::

    获取当前屏幕分辨率。

getpos()::

    获取当前鼠标位置。
    返回值为一个元组,以(x,y)形式表示。

move(x, y)::

    模拟移动鼠标。
    与goto不同,move()产生一个鼠标事件。

right_click()::

    模拟鼠标右键单击。

wheel(delta)::

    模拟滚动鼠标滚轮。
	delta: 滚动的距离, 正值为向上滚动, 负值为向下滚动。

新增: leftdown(),leftup(),rightdown(),rightup(),middledown(),middleup()模拟鼠标按下和释放。



示例代码1:

.. code-block:: python

    #模拟按键Alt+F4关闭当前窗口
    from event.key import *
    keydown("Alt")
    keydown("f4")
    keyup("f4")
    keyup("alt")


示例代码2:

.. code-block:: python

    #使用Aero Peek预览桌面。(Win7及以上系统)
    from event import mouse
    x,y=mouse.get_screensize()
    mouse.move(x,y) #将鼠标移至屏幕右下角
    mouse.click() #模拟鼠标点击


新增功能 New Features: 

1.1.2: event.key模块新增了按键名, 兼容PyWinHook库。完善了示例:录制键鼠事件(包目录\\examples\\录制键鼠事件.py)

说明: 使用示例"录制键鼠事件.py" 需安装pywinhook库。

1.0.3:修复了调用API函数时出现 ``ValueError`` 的bug。

1.0.2:增加了示例:鼠标控制器(包目录\\examples\\mouseController.py)

源代码 Source: https://github.com/qfcy/Python/tree/main/event

作者 Author:

qfcy qq:3076711200 百度贴吧账号:qfcy\_

作者CSDN主页: https://blog.csdn.net/qfcy\_/
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/qfcy/Python/tree/main/event",
    "name": "event-simulate",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "event,simulate,key,mouse,click,automation,\u952e\u76d8,\u9f20\u6807,\u5916\u6302",
    "author": "\u4e03\u5206\u8bda\u610f qq:3076711200",
    "author_email": "3076711200@qq.com",
    "download_url": "https://files.pythonhosted.org/packages/9a/ad/6fd017e10ae16bf6c3fe6eddcc2c4f42e7393561662d604c45b9ad1e7201/event-simulate-1.1.2.tar.gz",
    "platform": null,
    "description": "\u6a21\u5757\u540d\u79f0: event (\u5207\u52ff\u4f7f\u7528import event_simulate) !\r\n\r\n\u7b80\u4ecb\r\n====\r\n\r\nevent-simulate\u662f\u4e00\u4e2a\u6a21\u62df\u952e\u76d8,\u9f20\u6807\u4e8b\u4ef6\u7684Python\u5305, \u53ef\u4ee5\u6a21\u62df\u9f20\u6807\u5355\u51fb\u3001\u53cc\u51fb, \u952e\u76d8\u6309\u4e0b\u7b49\u5404\u79cd\u64cd\u4f5c,\r\n\r\n\u6253\u5305\u6210PyInstaller\u7b49exe\u6587\u4ef6\u65f6\u4f53\u79ef\u5c0f\u5de7\u3002\u53ef\u7528\u4e8e\u7f16\u5199\u81ea\u52a8\u5316\u7a0b\u5e8f (\u5982\u6e38\u620f\u5916\u6302\u7b49)\u3002\r\n\r\n\r\n\u6240\u5305\u542b\u6a21\u5757 Included modules: \r\n============================\r\n\r\nevent.key - \u6a21\u62df\u952e\u76d8\u4e8b\u4ef6\r\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\r\n\u5305\u542b\u7684\u51fd\u6570 Functions:\r\n\r\nkeydown(keycode_or_keyname)::\r\n\r\n    \u6a21\u62df\u952e\u6309\u4e0b\u3002\r\n    keycode_or_keyname:\u6309\u952e\u540d\u79f0\u6216\u8be5\u6309\u952e\u7684\u952e\u7801\u503c\r\n\r\nkeypress(keycode_or_keyname, delay=0.05)::\r\n\r\n    \u6a21\u62df\u6309\u952e\u3002\r\n    keycode_or_keyname:\u6309\u952e\u540d\u79f0\u6216\u8be5\u6309\u952e\u7684\u952e\u7801\u503c\r\n    delay:\u952e\u6309\u4e0b\u4e0e\u91ca\u653e\u4e4b\u95f4\u7684\u7684\u95f4\u9694\u65f6\u95f4,\u95f4\u9694\u65f6\u95f4\u8d8a\u5c0f,\u6309\u952e\u901f\u5ea6\u8d8a\u5feb\u3002\r\n\r\nkeyup(keycode_or_keyname)::\r\n\r\n    \u6a21\u62df\u952e\u91ca\u653e\u3002\r\n    keycode_or_keyname:\u6309\u952e\u540d\u79f0\u6216\u8be5\u6309\u952e\u7684\u952e\u7801\u503c\r\n\r\n\r\nevent.mouse - \u6a21\u62df\u9f20\u6807\u4e8b\u4ef6\r\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\r\n\u5305\u542b\u7684\u51fd\u6570 Functions:\r\n\r\nclick()::\r\n\r\n    \u6a21\u62df\u9f20\u6807\u5de6\u952e\u5355\u51fb\r\n\r\ndblclick(delay=0.25)::\r\n\r\n    \u6a21\u62df\u9f20\u6807\u5de6\u952e\u53cc\u51fb\r\n\r\nget_screensize()::\r\n\r\n    \u83b7\u53d6\u5f53\u524d\u5c4f\u5e55\u5206\u8fa8\u7387\u3002\r\n\r\ngetpos()::\r\n\r\n    \u83b7\u53d6\u5f53\u524d\u9f20\u6807\u4f4d\u7f6e\u3002\r\n    \u8fd4\u56de\u503c\u4e3a\u4e00\u4e2a\u5143\u7ec4,\u4ee5(x,y)\u5f62\u5f0f\u8868\u793a\u3002\r\n\r\nmove(x, y)::\r\n\r\n    \u6a21\u62df\u79fb\u52a8\u9f20\u6807\u3002\r\n    \u4e0egoto\u4e0d\u540c,move()\u4ea7\u751f\u4e00\u4e2a\u9f20\u6807\u4e8b\u4ef6\u3002\r\n\r\nright_click()::\r\n\r\n    \u6a21\u62df\u9f20\u6807\u53f3\u952e\u5355\u51fb\u3002\r\n\r\nwheel(delta)::\r\n\r\n    \u6a21\u62df\u6eda\u52a8\u9f20\u6807\u6eda\u8f6e\u3002\r\n\tdelta: \u6eda\u52a8\u7684\u8ddd\u79bb, \u6b63\u503c\u4e3a\u5411\u4e0a\u6eda\u52a8, \u8d1f\u503c\u4e3a\u5411\u4e0b\u6eda\u52a8\u3002\r\n\r\n\u65b0\u589e: leftdown(),leftup(),rightdown(),rightup(),middledown(),middleup()\u6a21\u62df\u9f20\u6807\u6309\u4e0b\u548c\u91ca\u653e\u3002\r\n\r\n\r\n\r\n\u793a\u4f8b\u4ee3\u78011:\r\n\r\n.. code-block:: python\r\n\r\n    #\u6a21\u62df\u6309\u952eAlt+F4\u5173\u95ed\u5f53\u524d\u7a97\u53e3\r\n    from event.key import *\r\n    keydown(\"Alt\")\r\n    keydown(\"f4\")\r\n    keyup(\"f4\")\r\n    keyup(\"alt\")\r\n\r\n\r\n\u793a\u4f8b\u4ee3\u78012:\r\n\r\n.. code-block:: python\r\n\r\n    #\u4f7f\u7528Aero Peek\u9884\u89c8\u684c\u9762\u3002(Win7\u53ca\u4ee5\u4e0a\u7cfb\u7edf)\r\n    from event import mouse\r\n    x,y=mouse.get_screensize()\r\n    mouse.move(x,y) #\u5c06\u9f20\u6807\u79fb\u81f3\u5c4f\u5e55\u53f3\u4e0b\u89d2\r\n    mouse.click() #\u6a21\u62df\u9f20\u6807\u70b9\u51fb\r\n\r\n\r\n\u65b0\u589e\u529f\u80fd New Features: \r\n\r\n1.1.2: event.key\u6a21\u5757\u65b0\u589e\u4e86\u6309\u952e\u540d, \u517c\u5bb9PyWinHook\u5e93\u3002\u5b8c\u5584\u4e86\u793a\u4f8b:\u5f55\u5236\u952e\u9f20\u4e8b\u4ef6(\u5305\u76ee\u5f55\\\\examples\\\\\u5f55\u5236\u952e\u9f20\u4e8b\u4ef6.py)\r\n\r\n\u8bf4\u660e: \u4f7f\u7528\u793a\u4f8b\"\u5f55\u5236\u952e\u9f20\u4e8b\u4ef6.py\" \u9700\u5b89\u88c5pywinhook\u5e93\u3002\r\n\r\n1.0.3:\u4fee\u590d\u4e86\u8c03\u7528API\u51fd\u6570\u65f6\u51fa\u73b0 ``ValueError`` \u7684bug\u3002\r\n\r\n1.0.2:\u589e\u52a0\u4e86\u793a\u4f8b:\u9f20\u6807\u63a7\u5236\u5668(\u5305\u76ee\u5f55\\\\examples\\\\mouseController.py)\r\n\r\n\u6e90\u4ee3\u7801 Source: https://github.com/qfcy/Python/tree/main/event\r\n\r\n\u4f5c\u8005 Author:\r\n\r\nqfcy qq:3076711200 \u767e\u5ea6\u8d34\u5427\u8d26\u53f7:qfcy\\_\r\n\r\n\u4f5c\u8005CSDN\u4e3b\u9875: https://blog.csdn.net/qfcy\\_/",
    "bugtrack_url": null,
    "license": "",
    "summary": "\u6a21\u62df\u952e\u76d8,\u9f20\u6807\u4e8b\u4ef6\u7684Python\u5305\u3002\u53ef\u7528\u4e8e\u7f16\u5199\u81ea\u52a8\u5316\u7a0b\u5e8f (\u5982\u6e38\u620f\u5916\u6302)\u3002A Python package simulating keyboard and mouse events ,which can be used in automation programs.",
    "version": "1.1.2",
    "project_urls": {
        "Homepage": "https://github.com/qfcy/Python/tree/main/event"
    },
    "split_keywords": [
        "event",
        "simulate",
        "key",
        "mouse",
        "click",
        "automation",
        "\u952e\u76d8",
        "\u9f20\u6807",
        "\u5916\u6302"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9aad6fd017e10ae16bf6c3fe6eddcc2c4f42e7393561662d604c45b9ad1e7201",
                "md5": "642e66c79bb9caac3cc949c302f4f91a",
                "sha256": "cca911fe4b309c20d4830df02ce60239b07e8285ece5b9eda839d99bc1771595"
            },
            "downloads": -1,
            "filename": "event-simulate-1.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "642e66c79bb9caac3cc949c302f4f91a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7197,
            "upload_time": "2024-01-09T12:05:05",
            "upload_time_iso_8601": "2024-01-09T12:05:05.332031Z",
            "url": "https://files.pythonhosted.org/packages/9a/ad/6fd017e10ae16bf6c3fe6eddcc2c4f42e7393561662d604c45b9ad1e7201/event-simulate-1.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-09 12:05:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "qfcy",
    "github_project": "Python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "event-simulate"
}
        
Elapsed time: 0.17784s