For simple applications, for example. when you just want to use color, you can try the function curses.setupterm. The following example uses curses to print red and green text at the bottom of the screen:
import curses
curses.setupterm()
black_bg = curses.tparm(curses.tigetstr("setab"), 0)
red = curses.tparm(curses.tigetstr("setaf"), 1)
green = curses.tparm(curses.tigetstr("setaf"), 2)
white = curses.tparm(curses.tigetstr("setaf"), 7)
print black_bg+white+"This is "+red+"red"+white
print "and this is "+green+"green"+white+"."
source
share