Is there any way to highlight, bold or change the color of one word in aYes.
variable to be displayed on a Tkinter GUI?
>You could separate them in two labels (if you are using labels), or
Like:
material = "Plastic"
introVal = "This report describes the construction of the %s." % (material)
apply a different tag if you are using a Text widget.
this is what I want:Changing the color is easier, you only change the foreground option.
This report describes the construction of the Plastic.
Plastic is Bold or Blue or Green
Changing to bold may not work for you, because depending on your Tk
version and platform it will already be bold, so you won't notice
anything. There is also a "catch" in changing text to bold, if you
only set the text option of your Label to "-weight bold" it will
probably get you a bold text, but with a different font than the one
being used by other Labels.
Now, something you could use as a base:
import Tkinter
import tkFont
root = Tkinter.Tk()
otherpart = Tkinter.Label(t ext="some text here")
special = Tkinter.Label(t ext="special", foreground='blu e')
otherpart.pack( side='left')
special.pack(si de='left')
f = tkFont.Font(fon t=otherpart['font'])
f['weight'] = 'bold'
f['underline'] = True
special['font'] = f.name
root.mainloop()
Thanks
--
http://mail.python.org/mailman/listinfo/python-list
--
-- Guilherme H. Polo Goncalves