简体   繁体   English

python tkinter顶级透明

[英]python tkinter toplevel transparent

i know that there is alot of these questions around, some thats said to work, and some thats said that dont work, however most of them are more than 2 years old, so i thought that something might have change that makes mine not work, what i want to do is simply make a tkinter window transparent, using python 3.4, 我知道周围有很多问题,有些是有效的,有些是无效的,但是大多数都已经超过2年了,所以我认为某些事情可能会发生变化,使我的工作不可行,我想做的只是使用python 3.4使tkinter窗口透明,

here is my code: 这是我的代码:

from tkinter import *
import time
root = Tk()
root.geometry('600x300')
root.wm_attributes('-alpha',0.3)
l = Label(root,bg='white',text='Text',width=50,height=20)
l.pack()


root.mainloop()

this creates a window, a label, etc, but i dont see any transparency, id realy like any help... thanks 这创建了一个窗口,一个标签等,但是我没有看到任何透明度,id真的像任何帮助一样...谢谢

oh, btw im using linux, ive got the wm_atributes from another website, its said to work, but it might have been meant that it works for windows 哦,顺便说一句,我正在使用linux,我从另一个网站获得了wm_atributes,据说可以用,但是可能是说它适用于Windows。

Oh, lookslike the problem is with Linux, ive copied the propgram to windows 7 and now it works, thanks for the help, so for anyone else who might find this usefull: 哦,看来问题出在Linux上,我已经将Program复制到Windows 7,现在可以正常工作了,感谢您的帮助,因此对于其他可能会觉得有用的人:

using: 使用:

from tkinter import *
import time
root = Tk()
root.geometry('600x300')
root.wm_attributes('-alpha',0.3)
l = Label(root,bg='white',text='Text',width=50,height=20)
l.pack()


root.mainloop()

this works in windows, but not for linux for some reason... 这在Windows中有效,但由于某些原因不适用于Linux ...

hope this helped 希望这有所帮助

thanks! 谢谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM