Python Tkinter text background Python Tkinter text background tkinter tkinter

Python Tkinter text background


Unfortunately create_text doesn't support that option. You can either overlay a tkInter text widget which does support bg and is described in your second link. Alternatively, you can use the bbox function to get the bounding box of the text and then overlay a white rectangle under the text which would have a similar effect.

Example of the second approach:

i=w.create_text(*textSet, text=i[3], font=("Helvetica", 16))r=w.create_rectangle(w.bbox(i),fill="white")w.tag_lower(r,i)