PyQt5 allows us to set the icon of window using setWindowIcon() method, on the other hand setWindowIconText() method is also present in it which allows us to set the text the icon.
Although, it is not recommended to use as it has not any use, there was use in previous i.e old versions. It is now used to make the old source codes working. It was used by the window manager now it is not used anymore.
Syntax : self.setWindowIconText(“text”)
Argument : It takes string as argument.
Return : If no icon is set it will return NULL string else return the text set before.
Code :
Python3
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import sys
class Window(QMainWindow):
def __init__( self ):
super ().__init__()
self .setWindowTitle( "Python" )
self .setWindowIcon(QIcon( "logo.png" ))
self .setWindowIconText( "logo" )
self .setGeometry( 60 , 60 , 600 , 400 )
self .label_1 = QLabel( "icon text " , self )
self .label_1.move( 100 , 100 )
self .label_1.adjustSize()
self .show()
App = QApplication(sys.argv)
window = Window()
sys.exit(App. exec ())
|
Output :

Note: This method is not recommended to use in codes, as it is of no use for modern systems.