制作一个不在任务栏中显示的GUI

时间:2018-02-15 20:28:39

标签: python tkinter

我正在尝试在任务栏上显示一个tkinter窗口(在我的情况下带有图像)。我已经尝试过使用here所述的方法,但回答的人没有提供示例,因此我无法复制它(我使用的是Windows 10,所以可能是是另一个需要考虑的因素。)

我的代码在这里。我使用的是Python 3.5

from tkinter import Toplevel, Tk, Label, PhotoImage

win = Tk()

win.attributes('-alpha', 0.0)
win.iconify()

window = Toplevel(win)
window.geometry("500x500+100+100")
window.overrideredirect(1)

photo = PhotoImage(file="testfile.png")

label = Label(window, image=photo)
label.pack()

win.mainloop()

1 个答案:

答案 0 :(得分:1)

链接的问题包含一个有趣的评论,建议扭转在that other answer中所做的工作。与此accepted answer一起解释所需的只是设置WS_EX_TOOLWINDOW样式,一个简单的例子是:

Enter-PSSession *computer*

$attributes = (Get-FsrmQuota | select Description, Size, PeakUsage)

foreach ($attribute in $attributes)
{
    $counter = $attributes.Count
    $descr = $attribute.Description
    $size = $attribute.size
    $tomb = @($descr.Split(";"))
    $mail = $tomb["1"]   # user mail adress
    $project = $tomb["0"] # user project
    $name = $mail.Split("@")[0] #username
    $firstName = $name.Split(".")[0]  
    $lastName = $name.Split(".")[1]
    $size = [Math]::Round(($attribute.Size)/1Gb,1).ToString() + " Gb" #storage size
    $usage = [Math]::Round(($attribute.Usage)/1Gb,1).ToString() + " Gb" #storage usage
    $percent = [Math]::Round((($attribute.Usage / $attribute.Size)*100),2).ToString() + "%"
    $projname = $array["2"] #project name


    for($i=1; $i -le $counter; $i++)
    {
        $ITBody = "The $projname project uses $size."
        $array+=$ITBody 
    }
}

write-host $array