# -*- coding: utf-8 -*-
import sys
import random
from PyQt4.QtGui import *
from PyQt4.QtCore import *
class BaseProgressDialog(QMainWindow):
def __init__(self, parent=None):
super(BaseProgressDialog,self).__init__()
self.setWindowTitle(u"定时关闭消息框!")
self.resize(400,300)
self.show()
infoBox = QMessageBox(self) ##Message Box that doesn't run
infoBox.setIcon(QMessageBox.Information)
infoBox.setText(u"保存完成!")
infoBox.setWindowTitle("Information")
infoBox.setStandardButtons(QMessageBox.Ok )
infoBox.button(QMessageBox.Ok).animateClick(2*1000) #3秒自动关闭
infoBox.exec_()
if __name__ == '__main__':
app = QApplication(sys.argv)
progress = BaseProgressDialog()
progress.show()
sys.exit(app.exec_())
pyqt4定时关闭消息框
最新推荐文章于 2024-06-28 18:39:14 发布