Help with Tkinter Alpha

时光毁灭记忆、已成空白 提交于 2020-06-18 12:57:37

问题


I have a python program that has no windows frame and doesn't show up in the taskbar because of self.overrideredirect(1). This program has an options menu (a top level widget) that allows for the alpha to be adjusted with self.attributes("-alpha", 0.85). However when I close out of the options menu my program shows up in the task bar. Obviously I don't want it to do this. I tried invoking the self.overrideredirect(1) command after the options menu was closed, but to no avail. Does anyone have a solution/ know of a line that will remove my program from the task bar?


回答1:


If you change the override redirect flag you need to withdraw and then deiconify the window to give the window manager a chance to make the change. You might try that.

Also, when you say "close out" the option menu top-level, what exactly do you mean? Are you sure destroying this second top-level window?




回答2:


You can do this with ease, just copy this code.

from Tkinter import *
app = Tk()
root.wm_attributes('-alpha', 0.8)
photo = PhotoImage(file="GifImage.gif")
Label(app, image=photo).pack()
app.mainloop()


来源:https://stackoverflow.com/questions/3644113/help-with-tkinter-alpha

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!