标签:
# -*- coding: cp936 -*-
import sys
from PyQt4 import QtGui
class MessageBox(QtGui.QWidget):
def __init__(self,parent=None):
QtGui.QWidget.__init__(self,parent)
self.setGeometry(300,300,250,150)
self.setWindowTitle(u‘你想关闭?‘)
def closeEvent(self,event):
reply=QtGui.QMessageBox.question(self,‘Message‘,
u‘你想关闭?‘,QtGui.QMessageBox.Yes,
QtGui.QMessageBox.No)
if reply==QtGui.QMessageBox.Yes:
event.accept()
else:
event.ignore()
app=QtGui.QApplication(sys.argv)
qb=MessageBox()
qb.show()
sys.exit(app.exec_())
如图:
标签:
原文地址:http://www.cnblogs.com/mhxy13867806343/p/4156329.html