【发布时间】:2021-05-24 21:09:08
【问题描述】:
我正在使用 Python Tkinter my_label.master.wm_attributes("-transparentcolor", "white") 将新弹出标签的背景变为透明,并使用 my_label.master.wm_attributes("-transparentcolor", "grey") 使其再次可见。这是有效的,因为我有一个白色背景,上面有黑色字母。
但这对我来说似乎有点贪婪。
是否有其他方法可以让背景再次可见?
【问题讨论】:
-
您是否尝试过使用:
.attributes("-transparentcolor", "none")? -
使用
my_label.master.attributes("-transparentcolor", "none")时会报错:unknown color name "none" -
来自this 尝试
.attributes("-transparentcolor", "")是合理的 -
这成功了。非常感谢。
-
没问题。诀窍是谷歌它(它没有工作)。如果这没有帮助,请查看文档。几个小时前我在看那个页面,但它仍然打开。
标签: python tkinter background label transparency