"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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4