Pmw ScrolledText Widget
Michael Peuser
mpeuser at web.de
Thu Sep 4 16:40:25 EDT 2003
"Andrew Wheatley" <awheat at imaging.robarts.ca> schrieb im Newsbeitrag
news:d44e8ee7.0309041134.110406a5 at posting.google.com...
> In the text component, I use the insert method to insert a line of
> text.
> Initially, I set the foreground colour of the text component to
> yellow, that is,
> all text is yellow. What I'd like to do is have different strings
> have different coloured text. You can't change the foreground color
> of the text component without changing all the strings to the same
> colour. Anyone know how to have
> different strings have different colours?
Text is a very versatile widget! Read the spec! You will have to use tags.
from Tkinter import *
t=Text()
t.pack()
t.tag_config('nice',background='green')
t.tag_config('reverse',background='black',foreground='white')
t.insert('end',"NICE","nice","REVERSE","reverse")
mainloop()
Kindly
Michael P
More information about the Python-list
mailing list