library to help with curses programming (Python 3.3+ compatible)

Usage

The easiest method is to just decorate your function, and use the injected scr argument:

from time import sleep from ezcurses import curse @curse def main(scr, message_string): w, h = scr.max_size() scr.write(message_string, pos=(w // 2, h // 2)) scr.refresh() sleep(1) if __name__ == '__main__': main('Hello world!')

You can also use the Cursed context manager. Here’s an example with windows with backgrounds and borders and colors:

from ezcurses import Cursed with Cursed() as scr: w, h = scr.max_size() win1 = scr.new_win(orig=(0, 0), size=(20, 20)) win2 = scr.new_win(orig=(20, 0), size=(20, 20)) win1.border() win2.border() win1.background('+', color='red') win2.background('.', color=('green', 'blue')) win1.refresh() win2.refresh() s = win1.getstr((1, 1), echo=True) win2.write(s, (1, 1), color=('red', 'black')) win2.refresh() win1.write('Press q to quit', (1, 1), color=('black', 'red')) while win1.getkey() != 'q': pass