从MS Windows任务栏隐藏窗口(hide window from MS windows taskbar)

编程入门 行业动态 更新时间:2024-10-25 20:25:06
从MS Windows任务栏隐藏窗口(hide window from MS windows taskbar)

使用pyGtk我创建了一个没有装饰的窗口。 该窗口隐藏在任务栏和所有窗口的顶部。 在Linux上它工作正常,但在MS Windows窗口有时它隐藏在其他窗口下,并且在Windows中始终具有“python.exe”任务栏。

代表我的问题的图像:

我怎样才能从任务栏隐藏这个“python.exe”窗口?

我的代码:

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()

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.

Image representing my problem:

How can I hide this "python.exe" window from taskbar?

My code:

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()

最满意答案

您有两个选项可以从任务栏中删除一个窗口:

添加WS_EX_TOOLWINDOW扩展窗口样式。 但是这有其他后果,我不能说他们是否认真。 给窗户一个不可见的所有者。 这允许你自由地使用你想要的任何窗口样式和扩展样式,但确实涉及更多的工作。

你的窗户会在其他窗户下方自然地出现。 这就是窗户的工作原理。 如果你想让你的窗口显示在最前面,用HWND_TOPMOST显示它。

我不知道这是如何(或不)在PyGtk下实现的。 我刚给你的Win32答案!

You have two options to remove a window from the taskbar:

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.

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.

I've no idea how any of this is (or is not) implemented under PyGtk. I've just given you the Win32 answer!

更多推荐

本文发布于:2023-08-07 16:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465514.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:任务栏   窗口   Windows   MS   taskbar

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!