I need help with changing the border colour of a canvas in tkinter
This is my code:
JavaScript
x
4
1
w = int(root.winfo_screenwidth())
2
loader = Canvas(width=w, height=20, bd=1)
3
loader.grid(column=0, row=1)
4
I have tried:
JavaScript
1
4
1
fill="black"
2
outline="black"
3
bd="black"
4
Advertisement
Answer
You can use highlightbackground
option to change color of border highlight ring(which is also a border-like thing, but is separate from the actual border). (correction, thanks to Bryan Oakley‘s comment )
To change border highlight ring thickness, you should use highlightthickness
option.
JavaScript
1
2
1
loader = Canvas( , highlightthickness=1, highlightbackground="black")
2
Also, if you want to remove that border highlight ring , you can set highlightthickness
to 0
.
JavaScript
1
2
1
loader = Canvas( , highlightthickness=0)
2