如何使用pyqt4自动关闭QDialogueBox

时间:2018-12-26 05:30:43

标签: python pyqt4

这是我的条件为false时的示例代码,我想使用object.close()方法关闭对话框,但是它无法正常工作。所以任何人都可以帮助我如何关闭对话框在这种情况下

下面是我的示例代码:

global startNow
if fileName:
            a = True
            while startNow:
                print startNow
                if startNow:
                    print 'showing dialog boxxxxxxxxxxxxx',startNow
                    self.dialogmsg = QtGui.QDialog()
                    self.dialogvbox = QtGui.QVBoxLayout(self.dialogmsg)
                    self.dialogmsg .setGeometry(550,400,300,100)
                    self.msglabel = QtGui.QLabel("Please Wait A Minute The Data is Processing" )
                    self.dialogvbox.addWidget(self.msglabel)
                    self.dialogmsg.exec_()
                    print 'box is therrrrrrrrr'
                    a = False
                    # self.dialogmsg.close()

                if not startNow:
                    print startNow,'closeeeeeeee'
                    try:
                        print 'try  closinggggggg'
                        self.dialogmsg.close()
                    except:
                        print 'except closing erorrrrrrrrrr'
                        pass
                    break

0 个答案:

没有答案