Home > front end >  the shadow of my button in tkinter won't disappear
the shadow of my button in tkinter won't disappear

Time:01-14

I am on MacOs with ventura installed. I am trying to create a button but it always has a shadow. I tried highlightthickness=0 and borderwidth=0 but it is still there. I tried another code from the internet but it was the same prolem. The same code is working on my friends computer. I tried to update tkinter, pip and python but they were on the latest version. I even tried to use sudo but nothing could fix it. It would really nice if somebody had a clue of another possibility.

Here is my code:

from tkinter import *

win = Tk()

# settings

window_height = 500
window_width = 500

# window

win.title("Polygon Selector")
win.resizable(False, False)
win.geometry(str(window_width)   "x"   str(window_height))
win.configure(bg="#F7F7F7")
can = Canvas(win,width=window_width,height=window_height,bg="#F7F7F7",highlightthickness=0)
can.place(x=0,y=0)

# content

label1 = Label(win,text="Here you can create different polygons\\n!! HAVE FUN !!",
fg="#FFB26B", bg="#F7F7F7")
label1.pack()

button = Button(win, text="To the selection", bg="#000000",highlightthickness=0, borderwidth=0)
button.pack()

win.mainloop()

CodePudding user response:

You can't remove the border of buttons on OSX. That's something unique to that platform.

You can use a Label widget and add your own bindings for button clicks to simulate a button. The Label widget can have the border removed.

  • Related