1

How to call a function when clicked close(X) button present at the top-right side of the window in pyqt4. The below code displays a window which has a table and the link has an image and description of output of the code.

from PyQt4 import QtCore, QtGui
import sys
app = QtGui.QApplication(sys.argv)
table = QtGui.QTableWidget()
table.setGeometry(QtCore.QRect(220, 100, 881, 100))
table.setColumnCount(4)
table.setRowCount(1)
table.setHorizontalHeaderLabels(QtCore.QString("Id;name;address;country").split(";"))

table.setColumnWidth(0, 120)
table.setColumnWidth(1, 450)
table.setColumnWidth(2, 140)
table.setColumnWidth(3, 140)

table.show()
app.exec_()

Click here for image

Aamna D
  • 45
  • 1
  • 1
  • 7
  • use `table.setWindowFlags( QtCore.Qt.CustomizeWindowHint | QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowMinMaxButtonsHint )` – eyllanesc Apr 02 '19 at 07:25
  • @eyllanesc Thank you for your response, it's working fine. Are there any events related to close(X) button. – Aamna D Apr 02 '19 at 07:29

0 Answers0