Registry / http-networking / curtsies

curtsies

JSON →
library0.4.3pypypi✓ verified 86d ago

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 curtsies
INSTALL
IMPORT
SIG · CURTSIES
C
curtsies
http-networkingpythonv0.4.3
Install
2.0s avg
Import
500ms
Disk
23MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.4.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.540s · 27MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.0s · import 0.460s · 28MB
23MB installed
● package 23MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FullscreenWindow
from curtsies import FullscreenWindow
Input
from curtsies import Input
FSArray
from curtsies import FSArray
fmtfuncs
from curtsies.fmtfuncs import red, bold, on_blue

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.

import random import sys from curtsies import FullscreenWindow, Input, FSArray from curtsies.fmtfuncs import red, bold, green, on_blue, yellow print(yellow('This prints normally, not to the alternate screen')) with FullscreenWindow() as window: a = FSArray(window.height, window.width) msg = red(on_blue(bold('Press escape to exit, space to clear.'))) a[0:1, 0:msg.width] = [msg] window.render_to_terminal(a) with Input() as input_generator: for c in input_generator: if c == '<ESC>': break elif c == '<SPACE>': a = FSArray(window.height, window.width) else: s = repr(c) row = random.choice(range(window.height)) column = random.choice(range(window.width - len(s))) color = random.choice([red, green, on_blue, yellow]) a[row, column:column + len(s)] = [color(s)] window.render_to_terminal(a)
Debug
Known issues
breakingPython 3.7, 3.8, and 3.9 are no longer supported. Users on these Python versions must upgrade to Python 3.10 or newer, or stick to an older curtsies version.
fix
Upgrade your Python environment to 3.10+ or pin `curtsies<0.4.3`.
affects: >=0.4.3
breakingCurtsies switched its backend from `curses` to `blessed` in version 0.4.0. While largely compatible, subtle behavioral changes or reliance on `curses`-specific features might break existing code.
fix
Review your application's terminal interaction, especially if you were previously interacting directly with the underlying `curses` library functionality. Test thoroughly after upgrading.
affects: >=0.4.0
breakingPython 3.6 support was dropped in version 0.4.0. Users on Python 3.6 must upgrade or use an older `curtsies` version.
fix
Upgrade your Python environment to 3.7+ (preferably 3.10+) or pin `curtsies<0.4.0`.
affects: >=0.4.0
gotchaApplication crashes can leave the terminal in a 'messed up' state (e.g., no echo, strange characters). This is common for `curses`-like libraries.
fix
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.
affects: All versions
gotchaThe `Input` class can return keypresses named differently depending on the `keynames` parameter. The default 'curtsies' might differ from 'curses' or 'plain', leading to unexpected input handling if not explicitly specified.
fix
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.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'curtsies'
The 'curtsies' library is not installed in the Python environment.
fix
Run `pip install curtsies` to install the library.
ModuleNotFoundError: No module named 'blessings'
The 'blessings' library, a dependency of 'curtsies', is missing. This can occur if 'curtsies' was installed in a way that didn't automatically resolve all dependencies, or if 'blessings' was uninstalled.
fix
Run `pip install blessings` to install the missing dependency, or `pip install --upgrade curtsies` to ensure all dependencies are correctly installed.
AttributeError: module 'curtsies' has no attribute 'Input'
This error typically occurs when a user tries to access a class like `Input` (or `FullscreenWindow`, `FSArray`) using `curtsies.Input` after only importing the top-level `curtsies` module, instead of importing the specific class directly.
fix
Instead of `import curtsies` followed by `curtsies.Input()`, use `from curtsies import Input` and then `Input()`.
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position ...
This error arises when `curtsies` attempts to process or display text containing non-ASCII characters in an environment where the default encoding is set to 'ascii' (e.g., in some Python 2 environments or misconfigured Python 3 setups), and it encounters bytes that cannot be represented in ASCII.
fix
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.
Upgrade
Version history
0.4.3latest on PyPI · released Jun 5, 2025
Audit
Dependencies
blessedrequiredUsed for terminal interaction since v0.4.0
cwcwidthrequiredUsed for character width calculations since v0.3.5
Agent activity
19 hits · last 30 days
node
18
OpenAI (training)
1
Resources
curtsies — pip install curtsies · libregistry