我使用tkinter
制作gui,-topmost
和overrideredirect
为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 Code。
所有的代码建议将受到赞赏。谢谢!
实际上,我正在使用powershell来尝试代码,在那个阶段,我发现即使在overrideredirect为真之后,它也会在任务栏中显示我的图标,即使我再次运行overrideredirect也会显示它。我认为它是匿名的。