I am trying to run this code to create a window with a given icon.
from PyQt5 import QtGui
from PyQt5.QtWidgets import QApplication, QWidget
class Window(QWidget):
def __init__(self):
super().__init__()
self.setWindowIcon(QtGui.QIcon('logo.png'))
self.setGeometry(100,100,800,800)
self.show()
if __name__=='__main__':
app = QApplication([])
window = Window()
app.exec_()
The file logo.png is in the same folder. The problem is that when I run the code I get a window with the default icon and not logo.png.