0

我用 qt 设计器设计了一个 ui,我在一个类中有一个 QSpinBox,我需要从另一个类中获取它的值,但是<function class.fun at 0x0000028549B1DEE0>当我打印它时我得到了它。当我尝试在同一个班级打印时,它可以工作,请帮忙

代码:

class Ui_Form(object):
    row = 1

    def setupUi(self, Form):
        
    --> self.repeat_2 = QtWidgets.QSpinBox(Form)
        self.repeat_2.setGeometry(QtCore.QRect(390, 310, 121, 51))
        self.repeat_2.setFont(font)
        self.repeat_2.setMinimum(1)
        self.repeat_2.setMaximum(1000000000)
        self.repeat_2.setObjectName("repeat_2")
        
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        _translate = QtCore.QCoreApplication.translate
        Form.setWindowTitle(_translate("Form", "E-aalim Google Maps"))
        self.strt_btn.setText(_translate("Form", "Start"))
        self.label_2.setText(_translate("Form", "Copyrights ©LorD OmaR®"))
        self.label_3.setText(_translate("Form", "Version 1.1"))
        self.email_choice.setCurrentText(
            _translate("Form", "blogs-vento@eaalim-blogs-commenter.iam.gserviceaccount.com"))
        self.email_choice.setItemText(0,
                                      _translate("Form", "blogs-vento@eaalim-blogs-commenter.iam.gserviceaccount.com"))
        self.email_choice.setItemText(1, _translate("Form",
                                                    "eaalim-comentarista@eaalim-blogs-commenter.iam.gserviceaccount.com"))
        self.warn.setText(_translate("Form", "-Make Sure To Share This Email With The Sheet-"))
        self.title.setText(_translate("Form", "E-aalim Google Maps"))
        self.repeat.setText(_translate("Form", "Repeat:"))
        self.strt_row.setText(_translate("Form", "Start Row:"))

    def asd(self):
        print(self.repeat_2.value())


class class2:
    Ui_Form.asd
4

1 回答 1

0

尝试:

class class2(QtWidgets.QWidget):
    def __init__(self):
        super().__init__()

        self.ui = Ui_Form()
        self.ui.setupUi(self)
        self.uiForm.asd()
于 2021-07-08T12:13:31.767 回答