简体   繁体   English

PyQt从任务栏删除窗口

[英]PyQt Remove Window from Taskbar

I'm trying to get a helper window to open in border less full screen and not have it appear on the task bar. 我试图让一个辅助窗口在边框较少的全屏模式下打开,并且没有出现在任务栏上。 I have gotten it to not appear on the task bar, but for some reason it ruins the size of the window, making it really small instead of full screen. 我知道它不会出现在任务栏上,但是由于某种原因,它破坏了窗口的大小,使其变得很小而不是全屏显示。

Here's the code that works as I want it to, except the window appears on the taskbar: 这是我想要的代码,除了窗口出现在任务栏上:

class BWindow(QtWidgets.QWidget):
    def __init__(self):
        global rect
        super(BWindow, self).__init__()

        self.setWindowFlags( 
                QtCore.Qt.Window
                |QtCore.Qt.CustomizeWindowHint
                | QtCore.Qt.FramelessWindowHint)
        self.move(rect.left(), rect.right())
        self.showMaximized()
        self.show()

This code below makes the window not appear on the task bar, but it completely ruins the size of the window, making it tiny instead of full screen for some reason. 下面的代码使窗口不会出现在任务栏上,但是由于某种原因,它完全破坏了窗口的大小,使其变得很小而不是全屏。

class BWindow(QtWidgets.QWidget):

    def __init__(self):
        global rect
        super(BWindow, self).__init__()

        self.setWindowFlags( 
                QtCore.Qt.Window
                |QtCore.Qt.CustomizeWindowHint
                | QtCore.Qt.FramelessWindowHint
                | QtCore.Qt.Tool)
        self.move(rect.left(), rect.right())
        self.showMaximized()
        self.show()

Thanks to strubbly for this: 感谢为此而努力:

"Do you want setFullScreen() rather than setMaximized()" “您要setFullScreen()而不是setMaximized()”

Changing self.showMaximized() to self.showFullScreen() fixed the problem and hides the window from the taskbar 将self.showMaximized()更改为self.showFullScreen()可解决此问题并从任务栏隐藏窗口

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

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