Thanks a lot Scott for the tip!

Regards
Karim

On 01/26/2011 07:10 PM, Scott Nelson wrote:
Curses is one way to go. Another is to use the PyWin32 module discussed in this thread:
http://thread.gmane.org/gmane.comp.python.tutor/58450/focus=58454
Basically, here's a snippet of code that can get you started. This requires that you have the PyWin32 module installed (already installed by default if you use ActiveState's Python distribution for Windows). Using PyWin32 isn't for the faint of heart, but it does work.
import win32console
handle = win32console.GetStdHandle(win32console.STD_OUTPUT_HANDLE)
handle.SetConsoleTextAttribute(win32console.FOREGROUND_BLUE)
print 'blue text'

On Wed, Jan 26, 2011 at 11:10 AM, Karim <karim.liat...@free.fr <mailto:karim.liat...@free.fr>> wrote:


    Hello all,

    Is there a simple way to print with color to stdout like the
    unix/linux example below:

    *print( '^[[1;31mThis is a warning!^[[0m' )

    where <Ctrl-V><esc> <=> ^[

    *I see thing with curses module. But is there an more simple
    object in other module to do the trick?
    Kind of _/decorate_output( mode=WARNING, *'This is a warning!')*/_

    Regards
    Karim

    _______________________________________________
    Tutor maillist  - Tutor@python.org <mailto:Tutor@python.org>
    To unsubscribe or change subscription options:
    http://mail.python.org/mailman/listinfo/tutor



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to