Curses & Colors

Rafael Mentz Aquino pythonlist at zumnet.com.br
Fri Feb 15 12:20:00 EST 2002


Thanks a lot, Gerhard,

I found yesterday night how to do it. There wasn't any problem at all,
it' s just that the default terminal file brings terminals without support
for colors, but this is changeable. And I did it! Now I am exploring
everything I can with curses (backgounds, attrs, ...)

Thanks a lot for your answer...

Rafael Mentz Aquino

Gerhard Häring wrote:

> Le 14/02/02 à 16:50, Rafael Mentz Aquino écrivit:
> > Hi, there...
> >
> > I'm creating some simple interfaces with curses with python under
> > FreeBSD, but I'm having some problems to change colors. I tried to do
> > something in /etc/termcap, but when I run curses.can_change_color(), I
> > always obtain 0.  My env term is cons25, but I don't know if python
> > uses the same terminal.  I'm running python 2.1.1. Can anybody help
> > me...? ;-))
>
> I recently fiddled with this, too. And it took me a while to get the
> curses code right. What I *can* do is give you some source that will
> work if color works at all:
>
> import curses
>
> def mymain(stdscr):
>     curses.init_pair(1, curses.COLOR_RED, curses.COLOR_WHITE)
>     stdscr.clear()
>
>     stdscr.addstr(0, 0, "This text is red on white.", curses.color_pair(1))
>
>     stdscr.refresh()
>     stdscr.getkey()
>
> curses.wrapper(mymain)
>
> I've no solution for how to activate color on your FreeBSD console,
> though. Maybe best ask on a FreeBSD group.
>
> Gerhard
> --
> This sig powered by Python!
> Außentemperatur in München: -0.7 °C      Wind: 4.1 m/s
>
> --
> http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list