报错代码:


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__()

 

Logo

讨论HarmonyOS开发技术,专注于API与组件、DevEco Studio、测试、元服务和应用上架分发等。

更多推荐