Python 如何在tkinter中创建带有倒圆的圆形按钮

Python 如何在tkinter中创建带有倒圆的圆形按钮,python,button,tkinter,Python,Button,Tkinter,我有一个带有背景的GUI,当我放置一个borderwidth=0的按钮时,它会显示一个圆形按钮,但周围有正方形。我怎样才能解决这个问题 这是我的按钮: 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

我有一个带有背景的GUI,当我放置一个
borderwidth=0
的按钮时,它会显示一个圆形按钮,但周围有正方形。我怎样才能解决这个问题

这是我的按钮:

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)
我的问题是:

我认为问题在于我的背景图像,但我不确定。因此,如果您感兴趣,这里是我如何设置背景图像的代码:

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

最好的方法是将图像的背景色编辑为tkinter表单的背景色。

您需要将背景色设置为窗口的主色,看起来像黑色

同时将highlightthickness和borderwidth设置为0,这样图像上就没有边框了

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


即使图像是透明的,
按钮
小部件的背景也不是透明的。是的,我也尝试过这个,但是它的命令是什么。bg=“backround_image”不起作用(^.^)/@razerGr33n
bg
需要字符串中的颜色名称吗?