【Python】RuntimeError: super-class __init__() of type TCPConnect was never called

RuntimeError: super-class __init__() of type TCPConnect was never called

 

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys

from PyQt5 import QtWidgets

from myTcpConnect.ui_tcp_login_v1 import UiTcpConnect


class TCPConnect(QtWidgets.QWidget, UiTcpConnect):
    def __init__(self):
        super(TCPConnect).__init__()
        self.setupUi(self)


if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    ui = TCPConnect()
    ui.show()
    sys.exit(app.exec_())


 

解决方法:加入self

【Python】RuntimeError: super-class __init__() of type TCPConnect was never called_第1张图片

你可能感兴趣的:(Debug,Python,Debug)