May 2019
Intermediate to advanced
542 pages
13h 37m
English
A status bar is a strip across the bottom of the application window designed for displaying short text messages and informational widgets. In Qt, a status bar is a QStatusBar object that we can assign to the main window's statusBar property.
We could create one like this:
status_bar = qtw.QStatusBar() self.setStatusBar(status_bar) status_bar.showMessage('Welcome to text_editor.py')
However, there's no need to go to so much trouble; the QMainWindow object's statusBar() method automatically creates a new status bar if there isn't one, or returns the existing one if there is.
So, we can reduce all that code to this:
self.statusBar().showMessage('Welcome to text_editor.py')
The showMessage() method does exactly what it says, ...
Read now
Unlock full access