Claudiu_Garba | 2020-05-07 16:26:42 UTC | #1
Hi there, when I press either the accept or cancel, the app closed. How could I prevent this?
https://www.pythonguis.com/courses/start/dialogs/
nickDunder | 2020-10-07 20:01:44 UTC | #2
This is probably because you are simply running the widget. Once the response is returned, the serial process continues until the termination of your script. If you do not have .show()
statement or further functionality in your UI, then you would have the ability to do is open, interact with, and close your dialog.
I recommend including the following script in your code to keep the main window open at runtime.
if name == 'main': app = QApplication(sys.argv) mw = MainWindow() mw.show() sys.exit(app.exec())
The complete guide to packaging Python GUI applications with PyInstaller.[[ discount.discount_pc ]]% OFF for the next [[ discount.duration ]] [[discount.description ]] with the code [[ discount.coupon_code ]]Purchasing Power Parity
Developers in [[ country ]] get [[ discount.discount_pc ]]% OFF on all books & courses with code [[ discount.coupon_code ]]
Of course, you will need to import sys in order to make this whole thing work.
Create GUI Applications with Python & Qt5 by Martin Fitzpatrick — (PyQt5 Edition) The hands-on guide to making apps with Python — Over 10,000 copies sold!