w = QtGui.QWidget() event = QtGui.QCloseEvent() QtGui.QMessageBox.information(w,"text" , "text") if w.close(): event.ignore() w.hide()