PyQt5 – How to hide app from taskbar ?
Last Updated :
26 Mar, 2020
While creating a PyQt5 app the window get opened and in task bar, automatically the app appears and when we close the app it get removed.
A taskbar is an element of a graphical user interface which has various purposes. It typically shows which programs are currently running. The specific design and layout of the taskbar varies between individual operating systems, but generally assumes the form of a strip located along one edge of the screen.
In this article we will see how to hide the app from the task bar, in order to do so we will use setWindowFlag()
method and pass which belongs to the QWidget class
.
Syntax : setWindowFlag(QtCore.Qt.Tool)
Argument : It takes Window type as argument.
Action performed : It hides the app from the task bar.
Code :
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5 import QtCore
import sys
class Window(QMainWindow):
def __init__( self ):
super ().__init__()
self .setWindowFlag(QtCore.Qt.Tool)
self .setWindowTitle( "NO task bar" )
self .setGeometry( 60 , 60 , 800 , 500 )
self .label_1 = QLabel( 'no task bar' , self )
self .label_1.move( 100 , 100 )
self .label_1.setStyleSheet("background - color: lightgreen;
border: 3px solid green")
self .show()
App = QApplication(sys.argv)
window = Window()
sys.exit(App. exec ())
|
Output :
Share your thoughts in the comments
Please Login to comment...