Terminal Cursor Visibility

1.3.5 · active · verified Tue Apr 14

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.

Warnings

Install

Imports

Quickstart

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.

import cursor
import time
import atexit

atexit.register(cursor.show) # Ensure cursor is shown on exit

print("Hiding cursor in 3 seconds...")
time.sleep(3)
cursor.hide()
print("Cursor hidden. It will reappear in 5 seconds.")
time.sleep(5)
cursor.show()
print("Cursor shown. Script finished.")

view raw JSON →