I want to know how should I chnage border color of tkinter Label or Button , I put the releif in solid
and the border color would be black . i have tried highlightthickness
,highlightcolor
,highlightbackground
but it doesnt work
here is a sample of my code :
import tkinter as tk
root = tk.Tk()
root.geometry("800x450")
root.title("How should i change border color")
tk.Label(root,text = "How should i change border color",width = 50 , height = 4 ,bg = "White",relief = "solid").place(x=10,y=10)
tk.Button(root,text = "Button",width = 5 , height = 1 ,bg = "White",relief = "solid").place(x=100,y=100)
root.mainloop()
and here is what i want to change(the border color that is Black now , I want to change it to red) :
I have tried What you said @moshe-perez but it doesnt work: image
When you use highlightbackground
you need to provide a color code, for example "#37d3ff"
.
So use highlightbackground="COLORCODE"
and remove relief="solid"
For example:
import tkinter as tk
root = tk.Tk()
root.geometry("800x450")
root.title("How should i change border color")
tk.Label(root, text="How should i change border color", width=50, height=4, bg="White", highlightthickness=4, highlightbackground="#37d3ff").place(x=10, y=10)
tk.Button(root, text="Button", width=5, height=1, bg="White", highlightbackground="#37d3ff").place(x=100, y=100)
root.mainloop()
result:
Update: While it workes on my ubuntu machine, I just checked it on windows and it doesn't work there.