如何在tkinter python中从任务栏中删除gui图标

2024-06-06 07:18:02 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用tkinter来制作gui,其中-topmostoverrideredirect为True。 我不想在任务栏中显示它的图标。我尝试过使用state函数,但它不适合这样做。我的代码:

from tkinter import Tk

def dragwin(event):
     x = root.winfo_pointerx() - _offsetx
     y = root.winfo_pointery() - _offsety
     root.geometry(f"+{x}+{y}")


 def clickwin(event):
     global _offsetx, _offsety
     _offsetx = event.x
     _offsety = event.y

root = Tk()
root.overrideredirect(1)
root.attributes("-topmost", True)
root.configure(background="black")
root.attributes('-alpha', 0.7)

# For motion of Window
root.bind('<Button-1>', clickwin)
root.bind('<B1-Motion>', dragwin)

root.mainloop()

我正在使用python 3.8.5和Visual Studio代码
所有代码建议将不胜感激。 谢谢


Tags: 代码eventtruetkinterdefrootattributestk
1条回答
网友
1楼 · 发布于 2024-06-06 07:18:02

实际上,我正在使用powershell尝试代码,在那个阶段,我发现即使在OverrideDirect为true之后,它仍会在任务栏中显示图标,即使我再次运行OverrideDirect,它也会显示图标。 我想是匿名的

相关问题 更多 >