[Tutor] Color text in Text widget

Alan G alan.gauld at freenet.co.uk
Mon Aug 1 23:20:36 CEST 2005


> I use the text's configuration to define tags that I apply to 
> sections of the text. For example:
>
> txtBox = Text(self, width=80, height=20)
> # configuration for red
> txtBox.insert(END,"I am red ", "r")

I don't know if it's the absolute best way but I didn't know you could
do that and I think its pretty neat! Pesonally I'd have been manually
changing the foreground colour before each insert!

Thanks for sharing.

Alan G.



More information about the Tutor mailing list