从 MS windows 任务栏隐藏窗口 [英] hide window from MS windows taskbar
问题描述
使用 pyGtk 我创建了一个没有装饰的窗口.该窗口隐藏在任务栏和所有窗口的顶部.在 linux 上它工作正常,但在 MS Windows 窗口上有时它隐藏在其他窗口下,并且 Windows 中的任务栏总是有python.exe".
Using pyGtk I created a window without decoration. The Window is hidden from task bar and top of all windows. On linux it works fine, but on MS Windows window sometimes it hides under some other window and always has "python.exe" the taskbar in windows.
代表我的问题的图片:
如何从任务栏中隐藏这个python.exe"窗口?
How can I hide this "python.exe" window from taskbar?
我的代码:
class Infowindow(gtk.Window):
'''
Klasa okienka informacyjnego
'''
def __init__(self, json, index, destroy_cb, device):
gtk.Window.__init__(self)
self.size_x = 260+48
self.size_y = 85
self.separator_size = 10
self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_SPLASHSCREEN)
self.set_decorated(False)
self.set_property('skip-taskbar-hint', True)
self.set_opacity(1)
self.set_keep_above(True)
self.add_events(gtk.gdk.BUTTON_PRESS_MASK)
self.connect("enter-notify-event", self.__on_hover)
self.connect("leave-notify-event", self.__on_leave)
self.connect("button_press_event", self.__on_click)
self.set_size_request(self.size_x, self.size_y)
color = gtk.gdk.color_parse('#f3f3f3')
self.modify_bg(gtk.STATE_NORMAL, color)
self.expanded = False
self.index = index
self.destroy_cb = destroy_cb
self.json = json['data']
self.system_info = False if 'system' not in self.json or not self.json['system'] else True
self.device = device
f = gtk.Frame()
self.move_window(index) #move window to specified place
self.box_area = gtk.VBox()
self.box_area.set_spacing(10)
f.add(self.box_area)
self.add(f)
self.show_all()
推荐答案
您有两个选项可以从任务栏中删除窗口:
You have two options to remove a window from the taskbar:
- 添加
WS_EX_TOOLWINDOW
扩展窗口样式.但这还有其他后果,我不能说它们是否严重. - 为窗口指定一个不可见的所有者.这让您可以自由地使用您希望的任何窗口样式和扩展样式,但需要做更多的工作.
- Add the
WS_EX_TOOLWINDOW
extended window style. But this has other consequences and I cannot say whether or not they are serious. - Give the window an owner that is not visible. This allows you freedom to use whatever window styles and extended styles you wish, but does involve more work.
很自然地,您的窗户会位于其他窗户下方.窗户就是这样工作的.如果您想让您的窗口出现在顶部,请使用 <代码>HWND_TOPMOST.
It's natural that your window will go beneath other windows. That's how windows works. If you want to make your window appear on top, show it with HWND_TOPMOST
.
我不知道在 PyGtk 下是如何(或不是)实现的.我刚刚给了你 Win32 的答案!
I've no idea how any of this is (or is not) implemented under PyGtk. I've just given you the Win32 answer!
这篇关于从 MS windows 任务栏隐藏窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!