{"id":21592,"library":"mouse","title":"mouse","description":"Library to hook and simulate mouse events on Windows and Linux. Current version 0.7.1. Maintained infrequently, with rare releases.","status":"active","version":"0.7.1","language":"python","source_language":"en","source_url":"https://github.com/boppreh/mouse","tags":["mouse","input-simulation","hook","automation","gui-testing"],"install":[{"cmd":"pip install mouse","lang":"bash","label":"Default install"}],"dependencies":[],"imports":[{"note":"","wrong":"","symbol":"mouse","correct":"import mouse"}],"quickstart":{"code":"import mouse\nmouse.move(200, 300)\nmouse.click('left')\nmouse.on_click(lambda: print('clicked'))\n# Record and play events\nrecorded = mouse.record()\nmouse.play(recorded)","lang":"python","description":"Move mouse, click, listen to clicks, record and replay events."},"warnings":[{"fix":"Use mouse.hook() to capture events non-blockingly, or run record() in another thread and call mouse.unhook_all() to stop.","message":"mouse.record() blocks until user presses right mouse button (by default). To stop recording programmatically, you must call mouse.unhook_all() from a separate thread or use hook().","severity":"gotcha","affected_versions":">=0.6.0"},{"fix":"Run as root or add user to 'input' group. Check /dev/input/mice access.","message":"On Linux, mouse requires X server and may need sudo for access to /dev/input/mice. Without proper permissions, hooks silently fail or no events fire.","severity":"gotcha","affected_versions":"all"},{"fix":"Use on_click callback to detect button presses instead.","message":"mouse.is_pressed() is not implemented; checking mouse button state is not supported. Only hooks and events are available.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Upgrade: pip install --upgrade mouse","cause":"Older version (<0.6.0) missing record/playback. Or pip installed wrong package.","error":"AttributeError: module 'mouse' has no attribute 'record'"},{"fix":"Add user to 'input' group: sudo usermod -a -G input $USER then logout/reboot, or run script with sudo.","cause":"User lacks permission to read input devices on Linux.","error":"OSError: [Errno 13] Permission denied: '/dev/input/mice'"},{"fix":"pip install mouse","cause":"Package not installed or virtual environment not activated.","error":"ImportError: No module named 'mouse'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}