kmhook


Namekmhook JSON
Version 1.0.2 PyPI version JSON
download
home_page
SummaryFiddle with mouse and french keyboard under Windows
upload_time2023-04-22 07:26:46
maintainer
docs_urlNone
author
requires_python>=3.10
licenseMIT License
keywords keyboard mouse detect event synthesize press release move
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # `kmHook`


`kmHook` only works on Windows, is pure Python using only `ctypes`, `time` and no other dependencies.

`kmHook` currently, only french AZERTY keyboards are supported.

`kmHook` allows you to detect, synthesize keyboard & mouse events.

`kmHook` also implements various related functions, see below.


# Example

```python
import kmhook as km

while not km.is_pressed('pause'):
    km.sleep(0.001) # recommended so that you don't consume CPU
    if km.is_pressed_once('space'):
        km.continuous_relative_move(600, 400, 500) # moves mouse smoothly during 500ms
```


`get_valid_key_names() -> tuple`

Returns all the valid key names to use within kmHook

    
`is_pressed(key: str | tuple[str] | list[str]) -> bool`

Checks if a key or a sequence of keys is being pressed.
    
`is_pressed_once(key: str | tuple[str] | list[str]) -> bool`

Checks if a key or a sequence of keys is being pressed but only once :
if the key was being pressed during the last call and is still being pressed,
this function returns False... until key is released and pressed again.
    
`press(key: str | list | tuple) -> None`

Presses the key (a single str or a sequence of keys) but does not release it
    
`press_and_release(key: str | list | tuple) -> None`

Presses and releases the key or the sequence of keys.
    
`release(key: str | list | tuple) -> None`

Releases the key (a single str or a sequence of keys).
    
`get_key_name() -> str`
        
Waits for a key to be pressed and return its name.
    
`get_mouse_pos() -> tuple[int, int]`

Returns current mouseposition.
        
`move_mouse_absolute(x: float | int, y: float | int) -> None`

Moves mouse absolutely to coordinates (x,y).
    
`move_mouse_relative(x: float | int, y: float | int) -> None`

Moves mouse relatively to current position.

`continuous_relative_move(x: float | int, y: float | int, time_interval: float | int) -> None`

Moves mouse relatively, smoothly and continuously during time_interval. Is blocking.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "kmhook",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "keyboard,mouse,detect,event,synthesize,press,release,move",
    "author": "",
    "author_email": "Fr\u00e9d\u00e9ric Leleu <ugli@mailo.com>",
    "download_url": "https://files.pythonhosted.org/packages/23/cc/32803b81a2bb30657e239c36b0c1f6775a280d1a713f17b11dcd2d8c97fc/kmhook-1.0.2.tar.gz",
    "platform": null,
    "description": "# `kmHook`\r\n\r\n\r\n`kmHook` only works on Windows, is pure Python using only `ctypes`, `time` and no other dependencies.\r\n\r\n`kmHook` currently, only french AZERTY keyboards are supported.\r\n\r\n`kmHook` allows you to detect, synthesize keyboard & mouse events.\r\n\r\n`kmHook` also implements various related functions, see below.\r\n\r\n\r\n# Example\r\n\r\n```python\r\nimport kmhook as km\r\n\r\nwhile not km.is_pressed('pause'):\r\n    km.sleep(0.001) # recommended so that you don't consume CPU\r\n    if km.is_pressed_once('space'):\r\n        km.continuous_relative_move(600, 400, 500) # moves mouse smoothly during 500ms\r\n```\r\n\r\n\r\n`get_valid_key_names() -> tuple`\r\n\r\nReturns all the valid key names to use within kmHook\r\n\r\n    \r\n`is_pressed(key: str | tuple[str] | list[str]) -> bool`\r\n\r\nChecks if a key or a sequence of keys is being pressed.\r\n    \r\n`is_pressed_once(key: str | tuple[str] | list[str]) -> bool`\r\n\r\nChecks if a key or a sequence of keys is being pressed but only once :\r\nif the key was being pressed during the last call and is still being pressed,\r\nthis function returns False... until key is released and pressed again.\r\n    \r\n`press(key: str | list | tuple) -> None`\r\n\r\nPresses the key (a single str or a sequence of keys) but does not release it\r\n    \r\n`press_and_release(key: str | list | tuple) -> None`\r\n\r\nPresses and releases the key or the sequence of keys.\r\n    \r\n`release(key: str | list | tuple) -> None`\r\n\r\nReleases the key (a single str or a sequence of keys).\r\n    \r\n`get_key_name() -> str`\r\n        \r\nWaits for a key to be pressed and return its name.\r\n    \r\n`get_mouse_pos() -> tuple[int, int]`\r\n\r\nReturns current mouseposition.\r\n        \r\n`move_mouse_absolute(x: float | int, y: float | int) -> None`\r\n\r\nMoves mouse absolutely to coordinates (x,y).\r\n    \r\n`move_mouse_relative(x: float | int, y: float | int) -> None`\r\n\r\nMoves mouse relatively to current position.\r\n\r\n`continuous_relative_move(x: float | int, y: float | int, time_interval: float | int) -> None`\r\n\r\nMoves mouse relatively, smoothly and continuously during time_interval. Is blocking.\r\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Fiddle with mouse and french keyboard under Windows",
    "version": "1.0.2",
    "split_keywords": [
        "keyboard",
        "mouse",
        "detect",
        "event",
        "synthesize",
        "press",
        "release",
        "move"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "86bc9df7d5ba8eea6f8f2cddc67566c23739d6f25b89d949603c081c83c35b44",
                "md5": "a0dc553da4a0a09c3e3b50ec49adfd3e",
                "sha256": "3a3a996ae4644b639d978ef7788156d846b683f142358a14dc3b2b854ee3f767"
            },
            "downloads": -1,
            "filename": "kmhook-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a0dc553da4a0a09c3e3b50ec49adfd3e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 7623,
            "upload_time": "2023-04-22T07:26:44",
            "upload_time_iso_8601": "2023-04-22T07:26:44.240621Z",
            "url": "https://files.pythonhosted.org/packages/86/bc/9df7d5ba8eea6f8f2cddc67566c23739d6f25b89d949603c081c83c35b44/kmhook-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "23cc32803b81a2bb30657e239c36b0c1f6775a280d1a713f17b11dcd2d8c97fc",
                "md5": "7cad27e57e20ff3abb1917e4ea0d2ce8",
                "sha256": "0c40673530974f55e715d0f2e8d2b95c0e68fa9540968b541d9e8faaf150a29c"
            },
            "downloads": -1,
            "filename": "kmhook-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "7cad27e57e20ff3abb1917e4ea0d2ce8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 5882,
            "upload_time": "2023-04-22T07:26:46",
            "upload_time_iso_8601": "2023-04-22T07:26:46.154520Z",
            "url": "https://files.pythonhosted.org/packages/23/cc/32803b81a2bb30657e239c36b0c1f6775a280d1a713f17b11dcd2d8c97fc/kmhook-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-22 07:26:46",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "kmhook"
}
        
Elapsed time: 0.05810s