how can i create round buttons in tkinter with an backround

Viewed 1007

I have a GUI with a background and when I place a button with borderwidth=0 it shows me a round button but it has squares around it. How can I fix that?

so this is my button:

exit_image = tk.PhotoImage(file="cancel.png")
button_exit = tk.Button(root,image=exit_image, borderwidth=0 ,command=quit_window)
button_exit.place(relx=0.89, rely=0.009, relwidth=0.1, relheight=0.07)

my problem:

enter image description here

I think the problem lies in my background image but I am not sure. So if you are interested here is my code of how I set the background image:

#Backround Image:
backround_image = tk.PhotoImage(file="schloss3.png")
backround_label = tk.Label(root,image = backround_image)
backround_label.place(relwidth=1, relheight=1)
2 Answers

You need to set the background colour to the main colour of the window, which looks like black.

Also set the highlightthickness and borderwidth to 0, so there's no border on the image.

backround_label = tk.Label(root,image = backround_image,bg='black',highlightthickness=0,borderwidth=0)

Best way is you edit the background color of the image to the background of tkinter form.

Related