import sys
from PyQt5.QtCore import pyqtSignal, QObject
from PyQt5.QtWidgets import QMainWindow, QApplication
class mysignal(QObject):
closeApp = pyqtSignal(list)
class Example(QMainWindow):
def __init__(self):
super().__init__()
self.c = mysignal()
self.c.closeApp.connect(self.myclose)
self.show()
def mousePressEvent(self, event):
hehe = list(range(10))
self.c.closeApp.emit(hehe)
def myclose(self, mylist):
print(mylist)
self.close()
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())