【发布时间】:2021-02-14 01:43:34
【问题描述】:
我有一个带有背景的 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)
【问题讨论】:
-
即使图像是透明的,
Button小部件的背景也不透明。