-
-
Save jmk/3827718 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt4.QtCore import * | |
from PyQt4.QtGui import * | |
import sys | |
def Log_Closed(): | |
print "Bye bye" | |
class My_dlg(QDialog): | |
def __init__(self, parent=None): | |
QDialog.__init__( self, parent ) | |
#self.conn = open_connection() | |
print "Connection Opened" | |
close_btn = QPushButton("Actually Close") | |
QVBoxLayout(self).addWidget(close_btn) | |
close_btn.clicked.connect(self.Actually_Close) | |
self.destroyed.connect(Log_Closed) | |
# If false, the dialog won't delete itself on close. | |
self.setAttribute(Qt.WA_DeleteOnClose, False) | |
def Actually_Close(self): | |
print "Actually Close" | |
self.deleteLater() | |
if __name__ == "__main__": | |
app = QApplication(sys.argv) | |
# If true, don't quit when the dialog is closed. | |
app.setQuitOnLastWindowClosed(False) | |
main= QMainWindow() | |
tsd = My_dlg(main) | |
tsd.show() | |
sys.exit(app.exec_()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment