Here's an example below:
if __name__ == '__main__':
import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()
print "you just closed the pyqt window!!! you are awesome!!!"
The print statement above doesn't seem to get executed while the window is open or after I close the window. I want it to print after I close the window.