Curses in colour?
Chris Reay
mrchameleon at hotmail.com
Mon May 28 18:22:50 EDT 2001
Michael Hudson <mwh at python.net> wrote in message news:<m31yp9zll0.fsf at atrus.jesus.cam.ac.uk>...
>
> This works for me:
>
> import curses
>
> def main(stdscr):
> curses.init_pair(1,curses.COLOR_RED,curses.COLOR_BLUE)
> curses.init_pair(2,curses.COLOR_YELLOW,curses.COLOR_GREEN)
> curses.curs_set(0)
>
> win = curses.newwin(10,0,0,0)
> win.bkgd(curses.color_pair(1))
> win.box()
> win.addstr(1,2,"hello!",curses.color_pair(2))
> win.refresh()
> while win.getch() == -1:
> pass
>
> curses.wrapper(main)
>
> ... I'm far from being a curses expert, though.
>
> Cheers,
> M.
Thanks, Michael. That made the diffrence. The excellent article by
Eric Raymond on curses programming doesn't emphasise the requirement
to create one's own colour pairs a la
"curses.init_pair(1,curses.COLOR_RED,curses.COLOR_BLUE)".
Yours
Chris (no longer cursing curses)
More information about the Python-list
mailing list