Skip to content

Instantly share code, notes, and snippets.

@jmk

jmk/gist:3827718 Secret

Created October 3, 2012 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmk/3827718 to your computer and use it in GitHub Desktop.
Save jmk/3827718 to your computer and use it in GitHub Desktop.
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