【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 sysfrom PyQt5 import QtWidgetsfrom myTcpConnect.ui_tcp_login_v1 ...
·
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

更多推荐



所有评论(0)