TypeError:__ init __()缺少1个必需的位置参数:' window'

时间:2017-03-28 09:19:02

标签: python pyqt5 eventhandler

我是python的初学者我用PyQt5创建了2个接口 我想在一个按钮( infoButton )中添加事件处理程序,这样点击它就会打开第二个窗口。

第一个窗口是 的 mainInterface.py 有一个班级

class Main_Form(object)

    def setupUi(self, Form):
     ## here is the main interface
      self.infoButton.clickd.connect(self.infoWindo)

     def __init__(self, window):
        super(Main_Form, self).__init__()
        self.windo = window

     def infoWindow(self, window):
        import description
        self.windo = description.Ui_Form()
        window.info()
        self.windo.show()
if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    Form = QtWidgets.QMainWindow()
    ui = Main_Form()
    ui.setupUi(Form)
    Form.show()
    sys.exit(app.exec_())

我要打开 description.py

class Ui_Form(object): 
    def setupUi2(self, Info):
     #here is the second interface

并且错误显示为

in <module> ui = Main_Form()
TypeError: __init__() missing 1 required positional argument: 'window'

0 个答案:

没有答案