Python 2.7。 Tkinker。 Linux WindRiver。如何制作trasparent窗口?

时间:2018-02-17 16:45:53

标签: linux tkinter transparency

代码:

import Tkinter as tk

#start GUI part
root = tk.Tk()
# show no frame
root.overrideredirect(True) 

#root.wm_attributes("-alpha", 0.2) 

#If uncommented the line above raises:
#    root.wm_attributes("-alpha", 0.2) 
#  File "/opt/python27-x86_64/usr/lib/python2.7/lib-tk/Tkinter.py", line 1553, in wm_attributes
#    return self.tk.call(args)
#_tkinter.TclError: wrong # args: should be "wm attributes window"
 
#__version__ = "$Revision: 81008 $"

root.geometry('%dx%d+%d+%d' % (300, 300, 300, 300)) 

root.after(5000, root.destroy) 
#start
root.mainloop()

根据我到目前为止发现的这条线: root.wm_attributes(“ - alpha”,0.2)应该做的伎俩,但我得到错误“_tkinter.TclError:错误#args:应该是”wm属性窗口“”

有任何建议吗?

0 个答案:

没有答案