0

enter image description here

I am using a button widget and trying to put an image onto the button but the border of the button still shows up. This is similar to another complaint i had but the same fix doesnt work.

Garje
  • 25
  • 5

1 Answers1

1

As @Bryan Oakley stated in his comment, have you tried setting the borderwidth option to zero?

That is precisely what you need to do.

When creating the button:

b = Button(master, ..., borderwidth = 0)
b.pack()

Hope this helps!

Note: Look at BryanOakley's answer on highligththickness. This can also be useful at times.

10 Rep
  • 2,217
  • 7
  • 19
  • 33
  • _” Note: For a Canvas or Frame widget, use highlightthickness = 0 instead.”_ is not true. `borderwidth` and `highlightthickness` are not the same, and `Button`, `Canvas`, and `Frame` all support both. – Bryan Oakley May 22 '20 at 01:46
  • @BryanOakley I know, I just mentioned that highlightthickness exists for those widgets. Let me edit my answer. – 10 Rep May 22 '20 at 01:46
  • You shouldn’t use it _instead_. They serve different purposes. – Bryan Oakley May 22 '20 at 01:48
  • I have noticed when I use it for a Canvas widget that it removes a white border around a Canvas. In other words, it expands to fill a widget perfectly. – 10 Rep May 22 '20 at 01:50
  • Yes, it removes the highlight ring. That’s different from the border. – Bryan Oakley May 22 '20 at 02:18
  • @BryanOakley I have stated that in my answer. – 10 Rep May 22 '20 at 04:17
  • Not really, your terminology is a bit confusing You say you can use `highlightthickness=0` instead of `borderwidth=0`, but that isn't guaranteed to remove the border. A canvas can have both a highlight ring _and_ a border. Using `highlightthickness` instead of `borderwidth` won't remove the border. – Bryan Oakley May 22 '20 at 04:20