終了時に呼び出されるメソッド

2016/08/29

def closeEvent(self,event):


# -*- coding: utf-8 -*-

import sys
from PyQt4 import QtGui

class MyMainWindow(QtGui.QMainWindow):
    def __init__(self, *argv, **keywords ):
        super(MyMainWindow,self).__init__(*argv,**keywords)

    def closeEvent(self,event):
        print('close')

def main():
    app = QtGui.QApplication(sys.argv)
    w = MyMainWindow()
    w.show()
    sys.exit(app.exec_())

if __name__ == '__main__':
    main()