2014-11-04 145 views
3

我想有使用Tkinter的透明背景:Linux Mint的Tkinter的透明窗口

from Tkinter import * 
root = Tk() 
root.attributes('-alpha', 0.1) 
#~ root.wm_attributes('-alpha', 0.1) 
#~ root.wm_attributes("-transparentcolor", "white") 
#~ root.attributes("-fullscreen",True) 
root.mainloop() 

此代码工作正常的Windows,而不是使用Linux Mint的玛雅。注释掉了我尝试过的其他选项。任何建议可能是错误的?

回答

0

只要设置root.attributes('-alpha', 0.1)即使在撤销/恢复窗口后也不会在Linux中为我做任何事情。然而,对于不明就我一个理由,如果你改变的root第一类型(甚至将其设置为“正常”),则窗口变得透明:

from Tkinter import * 
root = Tk() 
root.attributes('-type', 'normal') 
root.attributes('-alpha', 0.1) 
root.mainloop() 

“型”是X11唯一属性。

至于其他尝试,attributeswm_attributes是相同的功能,因此您尝试使用root.wm_attributes('-alpha', 0.1)也是不合逻辑的。 此外,根据tcl/tk documentation'-transparentcolor'是一个仅限于Windows的属性,所以它在Linux中不起作用。