{"id":5891,"library":"cursor","title":"Terminal Cursor Visibility","description":"The `cursor` library (current version 1.3.5) is a small, cross-platform Python package designed to hide or show the terminal cursor. It provides simple functions for managing cursor visibility in command-line interfaces on both Linux and Windows, and also installs command-line utilities for quick control. Its release cadence is infrequent, indicating a stable and mature utility.","status":"active","version":"1.3.5","language":"en","source_language":"en","source_url":"https://github.com/GijsTimmers/cursor","tags":["terminal","cli","utility","cursor","console"],"install":[{"cmd":"pip install cursor","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"The library exposes `hide` and `show` as top-level functions directly under the `cursor` module, not as separate classes or attributes that need direct import.","wrong":"from cursor import hide, show","symbol":"cursor","correct":"import cursor"}],"quickstart":{"code":"import cursor\nimport time\nimport atexit\n\natexit.register(cursor.show) # Ensure cursor is shown on exit\n\nprint(\"Hiding cursor in 3 seconds...\")\ntime.sleep(3)\ncursor.hide()\nprint(\"Cursor hidden. It will reappear in 5 seconds.\")\ntime.sleep(5)\ncursor.show()\nprint(\"Cursor shown. Script finished.\")\n","lang":"python","description":"This quickstart demonstrates how to hide the terminal cursor, wait, and then show it again. It includes `atexit.register` to ensure the cursor is always made visible when the script exits, which is a crucial best practice for this library."},"warnings":[{"fix":"Always ensure `cursor.show()` is called when your application is done, or use `atexit.register(cursor.show)` to automatically restore the cursor on script termination.","message":"The terminal cursor will remain hidden even after your Python script exits unless `cursor.show()` is explicitly called. This can be confusing for users.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure you are using the correct library for the type of cursor you intend to control. For graphical cursors, methods within the respective GUI library or OS-specific tools are needed.","message":"This `cursor` library is specifically for managing the *terminal* text cursor. It does not control graphical mouse cursors (e.g., in GUI applications like Tkinter, Pygame) or database cursors (e.g., in `psycopg2`, `mysql-connector-python`).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Test terminal cursor control in a standard system terminal (e.g., Bash, PowerShell, CMD) to confirm library functionality. Consult your IDE's documentation for specific terminal interaction settings or known issues.","message":"When running scripts in certain IDEs or environments (e.g., Cursor IDE itself), the terminal output and cursor control might be abstracted or handled differently, potentially leading to unexpected behavior or an inability to hide/show the cursor as expected by the native terminal.","severity":"gotcha","affected_versions":"All versions, specific to IDE/environment integration"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}