Curtsies is a Python library designed for interactive terminal applications, offering full-screen window management, user input handling, and formatted text rendering with colors and styles. It enables developers to create dynamic terminal interfaces like text editors or games. The current version is 0.4.3, and it has a moderate release cadence, with recent updates focusing on Python version compatibility and minor feature enhancements.
pip install curtsiesVerified import paths — ran on the pinned version, not inferred.
This example initializes a full-screen terminal window, displays an instruction message, and then continuously captures user input. Pressing the escape key exits the application. Pressing space clears the screen, and other key presses are rendered randomly on the screen with different colors. This demonstrates basic window management, formatted text, and input handling.
Upgrade your Python environment to 3.10+ or pin `curtsies<0.4.3`.
Review your application's terminal interaction, especially if you were previously interacting directly with the underlying `curses` library functionality. Test thoroughly after upgrading.
Upgrade your Python environment to 3.7+ (preferably 3.10+) or pin `curtsies<0.4.0`.
Always wrap your `curtsies` code within `with FullscreenWindow() as window:` and `with Input() as input_generator:` context managers to ensure proper terminal restoration. For debugging, consider using `python -m curtsies.events` or `reset` command in your terminal if it gets stuck.
If integrating with `curses`-compatible code or needing specific key names, initialize `Input` with `keynames='curses'` or `keynames='plain'`. Always test input handling on various terminal emulators.
Run `pip install curtsies` to install the library.
Run `pip install blessings` to install the missing dependency, or `pip install --upgrade curtsies` to ensure all dependencies are correctly installed.
Instead of `import curtsies` followed by `curtsies.Input()`, use `from curtsies import Input` and then `Input()`.
Ensure your terminal and Python environment are configured to use a UTF-8 encoding. You can set the `PYTHONIOENCODING` environment variable to `utf-8` or explicitly encode/decode strings to UTF-8 before passing them to `curtsies` functions, for example, by using `string.encode('utf-8')` and `string.decode('utf-8')` where appropriate.