{"id":22423775,"url":"https://github.com/itzcozi/py-keyboard-class","last_synced_at":"2025-03-27T05:41:51.562Z","repository":{"id":206616509,"uuid":"717307426","full_name":"itzCozi/Py-Keyboard-Class","owner":"itzCozi","description":"A class used for sending inputs via virtual keyboard codes and win32 API","archived":false,"fork":false,"pushed_at":"2024-12-20T19:16:23.000Z","size":1443,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T10:43:52.672Z","etag":null,"topics":["c-types","low-level","python","python-class","win32"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itzCozi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-11T04:19:43.000Z","updated_at":"2024-12-20T19:16:27.000Z","dependencies_parsed_at":"2024-12-18T14:26:42.645Z","dependency_job_id":"479ec76c-28e7-4145-b942-6ddebac06502","html_url":"https://github.com/itzCozi/Py-Keyboard-Class","commit_stats":null,"previous_names":["itzcozi/py-keyboard-class"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzCozi%2FPy-Keyboard-Class","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzCozi%2FPy-Keyboard-Class/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzCozi%2FPy-Keyboard-Class/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzCozi%2FPy-Keyboard-Class/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itzCozi","download_url":"https://codeload.github.com/itzCozi/Py-Keyboard-Class/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245791906,"owners_count":20672669,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-types","low-level","python","python-class","win32"],"created_at":"2024-12-05T18:13:02.423Z","updated_at":"2025-03-27T05:41:51.546Z","avatar_url":"https://github.com/itzCozi.png","language":"Python","readme":"# Py-Keyboard-Class\n\nA class used for handling inputs via virtual keyboard codes and win32 API. The Keyboard class can send inputs via functions like `scrollMouse`, `pressAndReleaseKey`, `keyboardWrite` and `pressAndReleaseMouse` it can also return keystrokes using the `GetKeystroke` wrapper which polls key presses. This project can send keyboard and mouse inputs on windows for anything.\n\n![Keyboard class doc-string](.github/example.gif)\n\n[Source](https://github.com/itzCozi/Py-Keyboard-Class/blob/main/source/py_key.py)\n\n## Usage\n\n### getKeyState()\n\n```\nReturns the given key's current state\n\nArgs:\n  key_code (str | int): The key to be checked for state\n\nReturns:\n  bool: 'False' if the key is not pressed and 'True' if it is\n```\n\n### locateCursor()\n\n```\nReturns a tuple of the current X \u0026 Y coordinates of the mouse\n\nReturns:\n  tuple[int, int]: The current X and Y coordinates EX: (350, 940)\n```\n\n### moveCursor()\n\n```\nMoves the cursor to a specific coordinate on the screen.\n\nArgs:\n  x (int): The x-coordinate to be sent to user32\n  y (int): The y-coordinate to be sent to user32\n```\n\n### scrollMouse()\n\n```\nScrolls mouse up, down, right and left by a certain amount\n\nArgs:\n  direction (str): The way to scroll, valid inputs: (\n    up, down, right, left\n  )\n  amount (int): How much to scroll has to be at least 1\n  dx (int, optional): The mouse's position on the x-axis\n  dy (int, optional): The mouse's position on the y-axis\n```\n\n### pressMouse()\n\n```\nPresses a mouse button\n\nArgs:\n  mouse_button (str | int): The button to press accepted: (\n    left_mouse,\n    right_mouse,\n    middle_mouse,\n    mouse_button1,\n    mouse_button\n  )\n```\n\n### releaseMouse()\n\n```\nReleases a mouse button\n\nArgs:\n  mouse_button (str | int): The button to press accepted: (\n    left_mouse,\n    right_mouse,\n    middle_mouse,\n    mouse_button1,\n    mouse_button\n  )\n```\n\n### pressKey()\n\n```\nPresses a keyboard key\n\nArgs:\n  key_code (str | int): All keys in vk_codes dict are valid\n```\n\n### releaseKey()\n\n```\nReleases a keyboard key\n\nArgs:\n  key_code (str | int): All keys in vk_codes dict are valid\n```\n\n### pressAndReleaseKey()\n\n```\nPresses and releases a keyboard key sequentially\n\nArgs:\n  key_code (str | int): All keys in vk_codes dict are valid\n```\n\n### pressAndReleaseMouse()\n\n```\nPresses and releases a mouse button sequentially\n\nArgs:\n  mouse_button (str | int): The button to press accepted: (\n    left_mouse,\n    right_mouse,\n    middle_mouse,\n    mouse_button1,\n    mouse_button\n  )\n```\n\n### keyboardWrite()\n\n```\nWrites by sending virtual inputs\n\nArgs:\n  source_str (str): The string to be inputted on the keyboard, all\n  keys in the 'Alphanumerical' section of vk_codes dict are valid\n```\n\n## Code Pics\n\n\u003cdiv style=\"text-align: center;\"\u003e\n  \u003cdiv style=\"display: inline-block;\"\u003e\n    \u003cimg src=\".github/input-class.png\" alt=\"class for Keyboard input\" title=\"class for Keyboard input\" /\u003e\n    \u003cp\u003eMain Keyboard input class (before static type hinting was added)\u003c/p\u003e\n  \u003c/div\u003e\n  \u003cdiv style=\"display: inline-block; margin-right: 10px;\"\u003e\n    \u003cimg src=\".github/keyboard-doc-string.png\" alt=\"Keyboard class doc-string\" title=\"Keyboard class doc-string\" /\u003e\n    \u003cp\u003eKeyboard class doc-string\u003c/p\u003e\n  \u003c/div\u003e\n\u003c/div\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitzcozi%2Fpy-keyboard-class","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitzcozi%2Fpy-keyboard-class","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitzcozi%2Fpy-keyboard-class/lists"}