简体   繁体   中英

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

Changing self.showMaximized() to self.showFullScreen() fixed the problem and hides the window from the taskbar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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