{"id":6337,"library":"curtsies","title":"Curtsies: Curses-like Terminal Wrapper","description":"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.","status":"active","version":"0.4.3","language":"en","source_language":"en","source_url":"https://github.com/bpython/curtsies","tags":["terminal","curses","tui","cli","input","output","colored-text"],"install":[{"cmd":"pip install curtsies","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Used for terminal interaction since v0.4.0","package":"blessed","optional":false},{"reason":"Used for character width calculations since v0.3.5","package":"cwcwidth","optional":false}],"imports":[{"symbol":"FullscreenWindow","correct":"from curtsies import FullscreenWindow"},{"symbol":"Input","correct":"from curtsies import Input"},{"symbol":"FSArray","correct":"from curtsies import FSArray"},{"symbol":"fmtfuncs","correct":"from curtsies.fmtfuncs import red, bold, on_blue"}],"quickstart":{"code":"import random\nimport sys\nfrom curtsies import FullscreenWindow, Input, FSArray\nfrom curtsies.fmtfuncs import red, bold, green, on_blue, yellow\n\nprint(yellow('This prints normally, not to the alternate screen'))\n\nwith FullscreenWindow() as window:\n    a = FSArray(window.height, window.width)\n    msg = red(on_blue(bold('Press escape to exit, space to clear.')))\n    a[0:1, 0:msg.width] = [msg]\n    window.render_to_terminal(a)\n\n    with Input() as input_generator:\n        for c in input_generator:\n            if c == '<ESC>':\n                break\n            elif c == '<SPACE>':\n                a = FSArray(window.height, window.width)\n            else:\n                s = repr(c)\n                row = random.choice(range(window.height))\n                column = random.choice(range(window.width - len(s)))\n                color = random.choice([red, green, on_blue, yellow])\n                a[row, column:column + len(s)] = [color(s)]\n            window.render_to_terminal(a)","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade your Python environment to 3.10+ or pin `curtsies<0.4.3`.","message":"Python 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.","severity":"breaking","affected_versions":">=0.4.3"},{"fix":"Review your application's terminal interaction, especially if you were previously interacting directly with the underlying `curses` library functionality. Test thoroughly after upgrading.","message":"Curtsies 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.","severity":"breaking","affected_versions":">=0.4.0"},{"fix":"Upgrade your Python environment to 3.7+ (preferably 3.10+) or pin `curtsies<0.4.0`.","message":"Python 3.6 support was dropped in version 0.4.0. Users on Python 3.6 must upgrade or use an older `curtsies` version.","severity":"breaking","affected_versions":">=0.4.0"},{"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.","message":"Application crashes can leave the terminal in a 'messed up' state (e.g., no echo, strange characters). This is common for `curses`-like libraries.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"The `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.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z"}