Nobody wrote:
On Fri, 10 Jul 2009 09:23:54 +0000, garabik-news-2005-05 wrote:

I would like to learn a way of changing the colour of a particular
part of the output text. I've tried the following
On Unix operating systems this would be done through the curses interface:

http://docs.python.org/library/curses.html
Or using ANSI colour codes:

colours = {
            'none'       :    "",
            'default'    :    "\033[0m",
            'bold'       :    "\033[1m",

[snip]

# non-standard attributes, supported by some terminals

This comment should have appeared immediately after "none" ;)

Hard-coding control/escape sequences is just lame. Use the curses modules
to obtain the correct sequences for the terminal.

As the OP I'm really interested in doing so. I currently have all my colors hard-coded. Now It may be lame but as soon as I call curses.initscr(), it's just messing up with my terminal, moreover I didn't figure out how to "print 'hello'" using curses color codes.
Anyone has an example ? I'm pretty sure it may fit in one line.

JM


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to