In the script im doing, im using processes, so when I close the GUI using the x button, I have some zombies, I have a method to kill all when the close button is clicked so I need to开发者_StackOverflow社区 make the event of the x button to call this method, how can I do it?
Thanks in advance
You should be able to subclass the closeEvent of your window, call your function and then accept the event.
def closeEvent(self, event):
kill_zombies()
event.accept()
It would be nice if you update the user that the cleanup process is ongoing if it'll take a few seconds. Some users react badly to a close button that doesn't close right away and will just kill your app before the zombies have been zapped.
精彩评论