2

I am trying to remove the border that is coming with the buttons in my program.

I've tried adding bd=0 and highlightthickness=0 to the Button() but it's just not working.

Can anyone suggest how to do this?

Current code example:

self.highscore_button_image = ImageTk.PhotoImage(file="images/buttons/highscore.png")
    highscore_button = Button(self.menu_window, bd=0, highlightthickness=0, image=self.highscore_button_image)
    highscore_button.place(x=266, y=273)

Buttons: I want to remove the white border... It also comes with a regular button without an image

enter image description here

enter image description here

Python version: 2.7.1 OS: Mac OSX Lion

Using Tkinter at the moment...

Michael
  • 833
  • 1
  • 6
  • 25

3 Answers3

1

I'm not sure you can get rid of that border for a button. You could use a Label widget instead of a Button widget, and bind mouse events to it if it needs to be clickable. The Label widget doesn't have that button-y outline.

Brionius
  • 13,858
  • 3
  • 38
  • 49
1

highscore_button = Button(....,relief=FLAT)

The relief style of a widget refers to certain simulated 3-D effects around the outside of the widget, it can be RAISED, SUNKEN,FLAT,GROOVE,RIDGE.

Pakium
  • 293
  • 2
  • 9
1

Removing border on buttons on Mac is currently not allowed. OS X is quite strict at this, there is no way to remove the border if using tkinter. I recently just had the same problem and all the methods I've tried are not working properly on Mac while most of them work on Windows.

However, it is possible to do it on Windows using "relief=FLAT" or "highlightthickness=0". You can also use "padx=0, pady=0" to have a really thin border, it will still exist.

You can also check out this site which talks about styling tkinter widgets(not only buttons but all the widgets): http://effbot.org/tkinterbook/tkinter-widget-styling.htm You may change the colour of the border(ButtonFace) to the same colour of your background according to this site.

There is a similar question on button styling here as well: How to change the foreground or background colour of a Tkinter Button on Mac OS X?

Sushi6006
  • 29
  • 9