[Tutor] print a line in IDLE as bold, italics or a color

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Tue Aug 2 23:21:56 CEST 2005



On Tue, 2 Aug 2005, Victor Reijs wrote:

> I am trying to simply(?) print some text in a print statement as bold
> (or itlaics or an certain color). How do I do this in python? Browsing
> the web gives we all kind of soluation, but non seem to work (a lot are
> related when printing on the web).
>
> Say I want to print the text (in the mentioned format): This is bold,
> red, blue, italics
>
> How do I do this in python 2.2 and using IDLE?


Hi Victor,

You may need to open up a special window for doing text displays with some
variety.  The Tkinter system provides one, which can be opened up like
this:

######
import Tkinter
txtBox = Text()
######


We had some discussion about this just yesterday, and Jorge Louis de
Castro showed how to selectively insert colored text into that txtBox:

    http://mail.python.org/pipermail/tutor/2005-August/040244.html


Hope this helps!



More information about the Tutor mailing list