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

2016/08/29

Python2.7.10, PySide1.2.2

def closeEvent(self,event):


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

import sys
from PySide 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()