Saturday, November 16, 2024
Google search engine
HomeLanguagesPyQt5 – How to hide app from taskbar ?

PyQt5 – How to hide app from taskbar ?

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 :




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


Output :
pyqt-hide-taskbar-app

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments