How do I print out in the standard output coloured lines

Geoffrey Clements geoffrey.clementsNO at SPAMbaesystems.com
Fri Feb 2 09:35:29 EST 2007


<cniharral at gmail.com> wrote in message 
news:1170421768.302283.173170 at a34g2000cwb.googlegroups.com...
On Feb 2, 1:38 pm, rzed <rzan... at gmail.com> wrote:
> cnihar... at gmail.com wrote 
> innews:1170419225.989358.311600 at h3g2000cwc.googlegroups.com:
>
>
>
> > On Feb 2, 1:16 pm, rzed <rzan... at gmail.com> wrote:
> >> cnihar... at gmail.com wrote
> >> innews:1170417631.268771.108090 at v45g2000cwv.googlegroups.com:
>
> >> > Hi,
>
> >> >   I'm interested in printing out coloured lines of my
> >> >   application and
> >> > I don't know what to use. Can anybody give me an idea??
>

[snip]

>
> If you're on Linux, you could use the curses module. There may be
> a precompiled Windows version compatible with your Python version,
> or maybe not, but the Windows source is available, and you may be
> able to get it to work with your Python with some effort. Linux
> distros include curses, I think. For Windows curses, take a look
> at <http://adamv.com/dev/python/curses/>. You will understand why
> the phrase "Windows curses" is used, I expect.
>
> --
> rzed
>
> Yes, I'm on a Linux box. I've tried with the curses module, but I
> don't how I could fetch the current use of curses of my shell. I don't
> know if I'm talking about something impossible. I've made some tests
> with the curses module and works fine, but I need to capture the
> current window and change the attributes of texts.

You may find the following useful, it's from Gentoo's portage:
http://sources.gentoo.org/viewcvs.py/portage/main/trunk/pym/portage/output.py?rev=5780&view=markup

-- 
Geoff 





More information about the Python-list mailing list