Related Articles

Related Articles

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 :

filter_none

edit
close

play_arrow

link
brightness_4
code

# importing the required libraries
  
from PyQt5.QtWidgets import * 
from PyQt5.QtGui import * 
from PyQt5 import QtCore
import sys
  
  
class Window(QMainWindow):
    def __init__(self):
        super().__init__()
  
        # this will hide the app from task bar
        self.setWindowFlag(QtCore.Qt.Tool)
  
        # set the title
        self.setWindowTitle("NO task bar")
  
        # setting  the geometry of window
        self.setGeometry(60, 60, 800, 500)
  
        # creating a label widget
        # by default label will display at top left corner
        self.label_1 = QLabel('no task bar', self)
  
        # moving position
        self.label_1.move(100, 100)
  
        # setting up border and background color
        self.label_1.setStyleSheet("background-color: lightgreen;
                                    border: 3px solid green")
  
        # show all the widgets
        self.show()
  
  
# create pyqt5 app
App = QApplication(sys.argv)
  
# create the instance of our Window
window = Window()
# start the app
sys.exit(App.exec())

chevron_right


Output :
pyqt-hide-taskbar-app

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :