I have a mainwindow and from that I call another window, I want the a a slot to get executed when the second window is closed. Is there any way to do that?
new_window = secondWindow()
new_window.show()
new_window.closed.connect(self.another function)
Is there any signal defined like this, or is there some other way to do that without closing the main window?
The solution is to create a custom signal, and emit this signal in the closeEvent method:
class secondWindow(WidgetClass):
closed = pyqtSignal()
[...]
def closeEvent(self, event):
self.closed.emit()
WidgetClass.closeEvent(self, event)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With