Python 将变量传递给子窗体PYQT5

Python 将变量传递给子窗体PYQT5,python,python-3.x,pyqt,pyqt5,Python,Python 3.x,Pyqt,Pyqt5,我试图将一个数字传递给一个子表单,但当我调用该变量时,它并没有给出我传递给它的内容。我得到的不是一个数字,而是“”,并且我的数字被分配给“parent”变量。我做错了什么 此语句正在启动子窗体: self.child_win = childForm(self, 123) 此部件正在接收传递的变量: def __init__(self, myInt, parent=None): 以下是完整的代码: import sys from PyQt5 import uic, QtWidgets q

我试图将一个数字传递给一个子表单,但当我调用该变量时,它并没有给出我传递给它的内容。我得到的不是一个数字,而是“”,并且我的数字被分配给“parent”变量。我做错了什么

此语句正在启动子窗体:

self.child_win = childForm(self, 123) 
此部件正在接收传递的变量:

def __init__(self,  myInt, parent=None):
以下是完整的代码:

import sys
from PyQt5 import uic, QtWidgets

qtCreatorFile = "parent_form.ui" 
Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile)
LandingPageUI, LandingPageBase = uic.loadUiType("child_form.ui")

class MyApp(QtWidgets.QMainWindow, Ui_MainWindow):
    def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)

        self.btnOpenChild.clicked.connect(self.showChildForm) 


    def showChildForm(self):
        self.child_win = childForm(self, 123)        
        self.child_win.show()      


class childForm(LandingPageBase, LandingPageUI):
    def __init__(self,  myInt, parent=None):
        QtWidgets.QMainWindow.__init__(self)
        LandingPageBase.__init__(self)
        self.setupUi(self)

        self.myInt = myInt

        print("My int: " + str(self.myInt))


if __name__ == "__main__":
    app=QtWidgets.QApplication.instance() 
    if not app:  
         app = QtWidgets.QApplication(sys.argv)
    window = MyApp()
    window.show()
    sys.exit(app.exec_())

self.child\u win=childForm(123)
。如果不是这么简单的答案,我会感觉好多了。谢谢@ekhumoro
self.child\u win=childForm(123)
。如果不是这么简单的答案,我会感觉好多了。谢谢@ekhumoro!