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. clearMessage() method is used to clear the message set on the status bar which are set by showmessage() method.
Syntax : self.statusBar().clearMessage() Argument : It takes no argument. Action performed : It clears the message in status bar.
Code :
Python3
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import sys
class Window(QMainWindow):
def __init__( self ):
super ().__init__()
# set the title
self .setWindowTitle("Python")
# setting the geometry of window
self .setGeometry( 60 , 60 , 600 , 400 )
# setting status bar message
self .statusBar().showMessage("this is status bar")
# clearing the status bar message
self .statusBar().clearMessage()
# creating a label widget
self .label_1 = QLabel("No message in status bar", self )
# moving position
self .label_1.move( 100 , 100 )
# setting up the border
self .label_1.setStyleSheet("border : 1px solid blue;")
# resizing label
self .label_1.adjustSize()
# 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 :