打印将在整个班级中起作用,但操作不会

时间:2017-05-18 15:11:22

标签: python-2.7 pyqt4

当我在第二个窗口点击我的按钮时,它连接到顶级类并成功打印"是",当我点击绑定到self.Hault的停止按钮时,计时器停止并打印。当我点击第二个窗口上的按钮使其打印出来但是没有执行操作时,我有什么愚蠢的遗漏吗?

class Main(QMainWindow, Ui_MainWindow):
    def __init__(self, parent=None):
        super(Main, self).__init__(parent)
        self.setupUi(self)
        #timer commands
        self.Start_2.clicked.connect(self.start_time)
        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.Time)
        self.Stop.clicked.connect(self.Hault)
        self.window2 = None
    def Hault(self):
        self.timer.stop()

        print ('yes')
class Form(QtGui.QDialog, Ui_Form):
    def __init__(self, parent=None):
        super(Form, self).__init__(parent)
        self.setupUi(self)
        self.main1 = Main()
        self.pop_up_pushButton.clicked.connect(self.main1.Hault)

0 个答案:

没有答案