python logo

pyqt statusbar

Python hosting: Host, run, and code Python in the cloud!

PyQt5 supports a window status bar. This is a small bar at the bottom of a window that sometimes appears, it can contain text messages. 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 GUI Apps with PyQt5

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.

If you are new to programming Python PyQt, I highly recommend this book.

Download PyQT5 Examples


Leave a Reply: