Skip to main content

Simplified curses

Project description


 ______     __  __     ______     ______     ______     _____
/\  ___\   /\ \/\ \   /\  == \   /\  ___\   /\  ___\   /\  __-.
\ \ \____  \ \ \_\ \  \ \  __<   \ \___  \  \ \  __\   \ \ \/\ \
 \ \_____\  \ \_____\  \ \_\ \_\  \/\_____\  \ \_____\  \ \____-
  \/_____/   \/_____/   \/_/ /_/   \/_____/   \/_____/   \/____/

Simplified curses interface with concurrency, for quick and sane curses apps.

Allows easy creation of windows and menus. Code for each window runs concurrently.

Please see full documentation available here:

cursed was tested with Python 3.4 and 2.7, and depends on the Python package six for compatibility.


With pip, for the latest stable:

$ pip install cursed

Or from the project root directory:

$ python install



from cursed import CursedApp, CursedWindow

# the main context of the curses application
app = CursedApp()

# Derive from CursedWindow to declare curses windows to be created after
# It is required to declare X, Y, WIDTH, and HEIGHT for each window.
# You'll want to put the main looping code for each window thread in the `update` class function.

class MainWindow(CursedWindow):

    # Coordinate for top-left of window.
    X, Y = (0, 0)

    # WIDTH and HEIGHT can be 'max' or integers.
    WIDTH, HEIGHT = ('max', 'max')

    # Create a default border around the window.
    BORDERED = True

    def update(cls):
        ''' update runs every tick '''

        # Hello world printed at x,y of 0,0
        cls.addstr('Hello, world!', 0, 0)

        # Get character keycode of keypress, or None.
        if cls.getch() == 27:
            # Escape was pressed. Quit.
            # 'quit' must be triggered for each open window for the program to quit.
            # Call cls.trigger('quit') to quit the window you're in, and to quit the other
            # declared windows, call OtherWindow.trigger('quit') which will run in that
            # window's thread, regardless of where it's called.

# To trigger app to start
result =

# check if ctrl-C was pressed
if result.interrupted():
    # Raises an exception if any thread ran into a different exception.

Many more examples are available in the root of the repository at examples/

Release Notes

  • exposed gevent.sleep through a classmethod cls.sleep(seconds=0). This allows users to fix issues with long running update functions causing other windows to not respond.

  • Added a CursedWindow PAD, like the curses pad. This can have a huge width and height greater than the terminal width, but allow you to scroll around it. Useful for windows which need only display a smaller rectange of a larger window, like a map that scrolls around with arrow keys.

  • fixed the write and getstr classmethods, since they called _fix_xy twice

  • added info to menu example to explain addstr in update will overwrite menu display

  • added tons of documentation and examples

  • Better CursedMenu API

  • WIDTH or HEIGHT specified as ‘max’ will stretch to the full width or height of the terminal

  • patched issue with returning bytes in getstr

  • Implemented getstr

  • Fixed menu to fill up right side with whitespace

  • fixed menus stealing keypresses

  • left and right open menus to sides

  • refactored menus

  • implemented menus!

  • Project created

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cursed-0.2.1.tar.gz (15.3 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page