RuntimeError: super-class __init__() of type MainWindow was never called
一人关注
As I was coding the other day, I suddenly started getting this error: RuntimeError: super-class __init__() of type MainWindow was never called. I wasn't modifying anyhing in the near vicinity of the main window code, but even tracing back on my modifications I couldn't get the module to execute again. I isolated the startup code to the one below, but still get the error. For the life of me, I have no idea what it is. Help!!!
from PyQt6.QtWidgets import QApplication, QMainWindow
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("My PyQt6 Application")
if __name__ == "__main__":
try:
app = QApplication([])
mainApplication = MainWindow()
app.exec() # Start the event loop
except Exception as e:
print(f"An exception occurred: {e}")
请先登录再写评论。