[Python3] TypeError: descriptor '__init__' of 'super' object needs an argument

报错代码:


from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtGui import QIcon


class WindowCreator(QWidget):

    def __init__(self):
        super.__init__()
        self.initUI()

    def initUI(self):
        # Set the position and the scale of the window
        self.setGeometry(300, 300, 300, 220)
        # Set the title of the window
        self.setWindowTitle('Icon')
        # Set the Icon path
        self.setWindowIcon(QIcon("../media/iconMainWindow.png"))
        # Show the main Window
        self.show()


报错位置:

        super.__init__()

修正:

        super().__init__()

 

你可能感兴趣的:(Python)