While that code specifically works, the following code doesn't work. 
After manually recompiling Python 2.4.4 against ncurses, it works as 
expected (actually, *better* than expected - the Python I compiled does 
a better job of cleaning up after itself, whereas the default Python 
curses module leaves some garbage and random gray on the screen after 
exiting).

Using a module whose functionality is partially broken seems like a bad 
idea to me, so our preference would be to avoid using the Python modules 
as currently delivered.

import curses

screen = curses.initscr()
curses.noecho()
curses.start_color()
curses.init_pair(1,curses.COLOR_RED, curses.COLOR_WHITE)

screen.clear()
screen.border(0)
screen.addstr(4, 4, "Line 4", curses.color_pair(1))
screen.addstr(5, 4, "Line 5")

screen.getch()

curses.echo()
curses.endwin()

Danek Duvall wrote:
> Susan Sohn wrote:
>
>   
>> The TI team was asked to go off and more fully investigate using Python vs. C
>> as an implementation language for the text installer. We have done so and our
>> results are at:
>>
>> http://www.opensolaris.org/os/project/caiman/TextInstallerProject/Text_Install_Prog_Language/
>>     
>
> I don't understand not being able to do color in Python without ncurses?
>
>     from curses import setupterm, tparm, tigetstr
>     from curses import COLOR_RED, COLOR_GREEN, COLOR_BLUE
>
>     setupterm()
>
>     print "in %(red)sred%(normal)s, %(green)sgreen%(normal)s, and " \
>         "%(blue)sblue%(normal)s." % {
>             "red": tparm(tigetstr('setaf'), COLOR_RED),
>             "green": tparm(tigetstr('setaf'), COLOR_GREEN),
>             "blue": tparm(tigetstr('setaf'), COLOR_BLUE),
>             "normal": tigetstr('op')
>         }
>
> Danek
> _______________________________________________
> caiman-discuss mailing list
> caiman-discuss at opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/caiman-discuss
>   

Reply via email to