{"id":25695429,"url":"https://github.com/geeksloth/python-joystick-demo","last_synced_at":"2026-04-12T22:03:39.876Z","repository":{"id":278070937,"uuid":"934423253","full_name":"geeksloth/python-joystick-demo","owner":"geeksloth","description":"Simple example of Python Joystick","archived":false,"fork":false,"pushed_at":"2025-02-17T20:20:35.000Z","size":295,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-17T21:25:55.371Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geeksloth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-02-17T20:05:08.000Z","updated_at":"2025-02-17T20:20:38.000Z","dependencies_parsed_at":"2025-02-17T21:38:10.291Z","dependency_job_id":null,"html_url":"https://github.com/geeksloth/python-joystick-demo","commit_stats":null,"previous_names":["geeksloth/python-joystick-demo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geeksloth%2Fpython-joystick-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geeksloth%2Fpython-joystick-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geeksloth%2Fpython-joystick-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geeksloth%2Fpython-joystick-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geeksloth","download_url":"https://codeload.github.com/geeksloth/python-joystick-demo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240582047,"owners_count":19824145,"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":[],"created_at":"2025-02-25T00:43:33.886Z","updated_at":"2026-04-12T22:03:39.807Z","avatar_url":"https://github.com/geeksloth.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# python-joystick-demo\nSimple example of Python Joystick\n\nThis script initializes and runs an event loop to handle joystick events using the pyjoystick.sdl2 library.\nIt defines functions to print messages when a joystick is attached or detached, and to handle key events from the joystick.\nThe key_received function processes various joystick inputs such as buttons, hats (D-pad), and axes, and prints corresponding messages.\nFunctions:\n- print_add(joy): Prints a message when a joystick is attached.\n- print_remove(joy): Prints a message when a joystick is detached.\n- key_received(key): Handles key events from the joystick and prints corresponding messages based on the key type and value.\nThe script runs the event loop with the defined functions to handle joystick events.\n\n![joystick buttons](static/joystick.png)\n\n\nExample output while buttons are pressed and released:\n```\nAttatched  \u003c-- attached already before running the script\nDetatched Xbox 360 Controller  \u003c-- disconnect the controller\nAttatched Xbox 360 Controller  \u003c-- re-connect it again\nA pressed\nA released\nB pressed\nB released\nX pressed\nX released\nY pressed\nY released\nDPAD UP\nDPAD released\nDPAD UP\nDPAD UP-RIGHT\nDPAD UP\nDPAD released\nDPAD RIGHT\nDPAD released\nDPAD RIGHT\nDPAD released\nDPAD DOWN-RIGHT\nDPAD RIGHT\nDPAD released\nDPAD DOWN\nDPAD released\nDPAD DOWN\nDPAD DOWN-LEFT\nDPAD LEFT\nDPAD released\nDPAD LEFT\nDPAD released\nDPAD LEFT\nDPAD UP-LEFT\nDPAD LEFT\nDPAD released\nLB pressed\nLB released\nRB pressed\nRB released\nBACK pressed\nBACK released\nSTART pressed\nSTART released\nGUIDE pressed\nGUIDE released\nLT value: 0.0\nLT value: 0.18823529411764706\nLT value: 0.3411764705882353\nLT value: 0.5372549019607843\nLT value: 0.6823529411764706\nLT value: 0.8980392156862745\nLT value: 1.0\nLT value: 0.9450980392156862\nLT value: 0.7529411764705882\nLT value: 0.4980392156862745\nLT value: 0.25098039215686274\nLT value: 0.01568627450980392\nLT value: 0.0\nRT value: 0.0\nRT value: 0.12549019607843137\nRT value: 0.30980392156862746\nRT value: 0.6666666666666666\nRT value: 0.9803921568627451\nRT value: 1.0\nRT value: 0.9098039215686274\nRT value: 0.6196078431372549\nRT value: 0.24313725490196078\nRT value: 0.0\nLSY value: -1.5259021896696368e-05\nLSY value: -0.06251621271076524\nLSY value: -0.14064240482185097\nLSY value: -0.15626764324406806\nLSY value: -0.1093919279774167\nLSY value: -1.5259021896696368e-05\nLSY value: -0.03126573586633097\nLSX value: 1.5259021896696368e-05\nLSX value: -0.015609979400320384\nLSY value: -1.5259021896696368e-05\nLSX value: -0.2187380788891432\nLSX value: -0.4531166552224002\nLSX value: 1.5259021896696368e-05\nRSY value: -1.5259021896696368e-05\nRSY value: -0.023453116655222428\nRSY value: -0.3281452658884566\nRSY value: -0.3828336003662165\nRSY value: -0.29689478904402233\nRSY value: -0.10157930876630805\nRSY value: -1.5259021896696368e-05\nRSX value: 1.5259021896696368e-05\nRSX value: -0.1093614099336232\nRSX value: -0.21092545967803467\nRSX value: -0.29686427100022883\nRSX value: -0.33592736705577175\nRSX value: 0.8828412298771648\nRSX value: 1.0\nRSX value: 0.8672159914549478\nRSX value: 0.5312733653772794\nRSX value: 1.5259021896696368e-05\nLSY value: -0.015640497444113888\nLSY value: -1.5259021896696368e-05\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeeksloth%2Fpython-joystick-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeeksloth%2Fpython-joystick-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeeksloth%2Fpython-joystick-demo/lists"}