Skip to main content

Fiddle with mouse and french keyboard under Windows

Project description

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

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.

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

kmhook-1.0.2.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

kmhook-1.0.2-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file kmhook-1.0.2.tar.gz.

File metadata

  • Download URL: kmhook-1.0.2.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for kmhook-1.0.2.tar.gz
Algorithm Hash digest
SHA256 0c40673530974f55e715d0f2e8d2b95c0e68fa9540968b541d9e8faaf150a29c
MD5 7cad27e57e20ff3abb1917e4ea0d2ce8
BLAKE2b-256 23cc32803b81a2bb30657e239c36b0c1f6775a280d1a713f17b11dcd2d8c97fc

See more details on using hashes here.

File details

Details for the file kmhook-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: kmhook-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for kmhook-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3a3a996ae4644b639d978ef7788156d846b683f142358a14dc3b2b854ee3f767
MD5 a0dc553da4a0a09c3e3b50ec49adfd3e
BLAKE2b-256 86bc9df7d5ba8eea6f8f2cddc67566c23739d6f25b89d949603c081c83c35b44

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