简体   繁体   English

您如何从状态栏中隐藏GUI?

[英]How do you hide a gui from the statusbar?

I have Linux mint 18 and have created an app that is a status bar. 我有Linux Mint 18,并创建了一个状态栏应用程序。 It has various info temp CPU speed bat info and does various things to manage my laptop using Tkinter. 它具有各种信息临时CPU速度信息,并且可以使用Tkinter进行各种操作来管理我的笔记本电脑。 When using Mint every time you open an app it creates a tab in the status bar for every prog/folder anything. 每次打开应用程序时使用Mint时,它都会在状态栏中为每个编/文件夹创建一个选项卡。 I would like to hide my program from that. 我想从中隐藏我的程序。 I've looked into hiding and showing different ways but none of those seem to cover it and from googling the topic i couldn't find my specific question. 我研究了隐藏和显示不同方式的方法,但是这些方法似乎都没有涵盖它,并且通过搜索主题我找不到我的具体问题。 Any help on this would be very appreciated. 任何帮助,将不胜感激。

There are several ways to tell the desktop manager not to display the app in the taskbar: 有几种方法可以告诉桌面管理器不要在任务栏中显示该应用程序:

  • Change the window type from 'normal' to a type which is not displayed in the taskbar by default (depending on the type it can also remove window decorations and change the window position, eg always on top). 将窗口类型从“普通”更改为默认情况下不在任务栏中显示的类型(取决于类型,它也可以删除窗口装饰并更改窗口位置,例如始终位于顶部)。 For example, the 'toolbar' type will do exactly what you want. 例如,“工具栏”类型将完全满足您的要求。

     import tkinter as tk root = tk.Tk() root.attributes('-type', 'toolbar') root.mainloop() 

    You can find a list of types here . 您可以在此处找到类型列表。

  • You can also change yourself the state of your window with the ewmh module: 您还可以使用ewmh模块更改自己的窗口状态:

     import tkinter as tk from ewmh import EWMH ewmh = EWMH() root = tk.Tk() root.update_idletasks() # to make sure the window is displayed w = ewmh.getActiveWindow() # get the window ewmh.setWmState(w, 1, '_NET_WM_STATE_SKIP_TASKBAR') # remove window from taskbar ewmh.display.flush() root.mainloop() 

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

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