PyQt5 statusbar

PyQt5 supports a window status bar. To add a status bar add the line:

 self.statusBar().showMessage('Message in statusbar.')

A statusbar can be added to the main window (QMainWindow). It is one of the methods the class itself contains;

Related course:
Create Simple GUI Applications with Python and Qt

PyQt5 statusbar example:
The program below adds a statusbar to a PyQt5 window:

import sys
from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow
from PyQt5.QtGui import QIcon
class App(QMainWindow):
    def __init__(self):
        self.title = 'PyQt5 status bar example -'
        self.left = 10 = 10
        self.width = 640
        self.height = 480
    def initUI(self):
        self.setGeometry(self.left,, self.width, self.height)
        self.statusBar().showMessage('Message in statusbar.')
if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = App()

The example creates a window (QMainWindow). We set the screen parameters using:

self.left = 10 = 10
self.width = 640
self.height = 480

Window properties are set in the initUI() method which is called in the constructor. The method:


sets the text on the statusbar.

Download PyQT5 Examples


5 thoughts on “PyQt5 statusbar

  1. Rômulo Ponciano - August 19, 2017

    I got the same error of akilesh rajan. Python 3.6 x64 and PyQt5.

    1. Rômulo Ponciano - August 19, 2017

      I download the code that you provide and it’s works.

  2. akilesh rajan - August 6, 2017

    This doesn’t work. I get an error.
    File “D:/PycharmProject/”, line 18, in initUI
    self.statusBar().showMessage(‘Message in statusbar.’)
    AttributeError: ‘App’ object has no attribute ‘statusBar’

    1. Frank - August 8, 2017

      Switch to Python 3, I just ran the program without problem.

    2. mark zhang - January 23, 2018

      App must inherit Qmainwindow

Leave a Reply