[Tkinter-discuss] Border color ttk.Entry

Michael Lange klappnase at web.de
Tue Dec 14 19:54:13 CET 2010


Hi,

Thus spoketh craf <prog at vtr.net> 
unto us on Mon, 13 Dec 2010 13:05:07 -0300:

> Hi.
> 
> There any way to change the border color of a control ttk.Entry through
> options or style?
> 

if you mean the 1- or 2-pixel border used to (typically) draw the "sunken"
"3D" effect, then I don't think so. I believe these colors are
automagically derived by some internal Tk routine from the background
color of the widget.
However, you could try some trickery packing the entry into another Frame:

root = Tk()
f = Frame(root)
f.pack(fill='both', expand=1)
f1 = Frame(f, bg='blue', relief='sunken', bd=2)
f1.pack(padx=100, pady=100)
e = Entry(f1, relief='flat', bd=0)
e.pack(fill='both', expand=1)
root.mainloop()

(with ttk widgets you will have to configure the widget's styles instead
of adding simple config options of course, but I guess you see the
point.)

Regards

Michael

.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

Our way is peace.
		-- Septimus, the Son Worshiper, "Bread and Circuses",
		   stardate 4040.7.


More information about the Tkinter-discuss mailing list