I'm having an issue with a Python script that launches a pyqt5 GUI. Once the GUI is started from the launching script, the user has to provide some inputs and then close the application through a Close button. The method associated with the button ends with a "sys.exit()" to close the GUI.
The problem is that this command closes both the GUI and the launching Python script.
Is there a way to close just the GUI and not the launching script (that in my case has to do other stuff).
Change the method to not call sys.exit() , which terminates the process, but rather qApp.exit() , which only exits the qApp event loop (exec()) which you call in main ?
Othewrise, sys.exit() raises SystemExit exception, so maybe you can catch in main or by overriding QApplication.notify .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.