'normal' shell with curses

Thynnus thynnus at gNOTmail.com
Tue Mar 4 14:48:31 CET 2008

On 3/3/2008 9:57 PM, Michael Goerz wrote:
> Hi,
> I'm trying to print out text in color. As far as I know, curses is the 
> only way to do that (or not?). So, what I ultimately want is a curses 
> terminal that behaves as closely as possible as a normal terminal, i.e. 
> it breaks lines and scrolls automatically, so that I can implement a 
> function myprint(color, text) that does what print() does, only in color.

You might find the below helpful. Let us know how you make out?


Python Cookbook

  Using terminfo for portable color output & cursor control

The curses module defines several functions (based on terminfo) that can be 
used to perform lightweight cursor control & output formatting (color, bold, 
etc). These can be used without invoking curses mode (curses.initwin) or using 
any of the more heavy-weight curses functionality. This recipe defines a 
TerminalController class, which can make portable output formatting very 
simple. Formatting modes that are not supported by the terminal are simply omitted.


More information about the Python-list mailing list