Curses in colour?
Michael Hudson
mwh at python.net
Mon May 28 08:47:55 EDT 2001
mrchameleon at hotmail.com (Chris Reay) writes:
> Michael Hudson <mwh at python.net> wrote in message news:<m3r8xar86v.fsf at atrus.jesus.cam.ac.uk>...
> > mrchameleon at hotmail.com (Chris Reay) writes:
> > snip ...
> > > highlighting, for example. However my curses application won't, as
> > > this function, which returns 0 shows:
> > ... snip
> > Hmm, it returns 0 for me too - but color still works. Does it for
> > you?
> >
> > Cheers,
> > M.
>
> No it doesn't. Strange characters are displayed (in mono) if I try to.
> Would you be able to give me an exact example of how you display a
> colour-paired string in curses? I'd be grateful.
>
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.
--
All programs evolve until they can send email. -- Richard Letts
Except Microsoft Exchange. -- Art
-- http://home.xnet.com/~raven/Sysadmin/ASR.Quotes.html
More information about the Python-list
mailing list