Answer the question
In order to leave comments, you need to log in
How to set application icon in PyQt5?
The code according to which the application icon is set is given. However, I am unable to
import sys
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtGui import QIcon
class Example(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self) :
self.setGeometry(300, 300, 300, 220)
self.setWindowTitle('Icon')
self.setWindowIcon(QIcon('web.png'))
self.show()
if __name__ == '__main__':
app = QApplication (sys.argv)
ex = Example()
sys.exit(app.exec_())
PS Python 3.6.4
Answer the question
In order to leave comments, you need to log in
What specifically doesn't work? It is possible that the folder where the program is located simply does not have a file called " web.png " in the folder where the program is located. If it is, then say that it does not work.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question