python—从一个类到另一个类的qspinbox获取值

enyaitl3  于 2021-08-25  发布在  Java
关注(0)|答案(1)|浏览(266)

我用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
3b6akqbq

3b6akqbq1#

尝试:

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

        self.ui = Ui_Form()
        self.ui.setupUi(self)
        self.uiForm.asd()

相关问题