Issue
I'm new to PyQt6 and have ran into an issue which makes coding very tedious: when I close the application I'm working on using CMD+Q or the menu bar, the window closes but the application/python process stays in the menu bar and stops responding. I end up having to force close it every time.
I start the program by clicking the play button in the Spyder menu bar.
How do I properly set up the application to quit? This is the relevant part of the code I'm using:
from PyQt6.QtWidgets import QApplication, QWidget
import sys
class Window(QWidget):
def __init__(self):
super().__init__()
app = QApplication(sys.argv)
window = Window()
window.show()
sys.exit(app.exec())
My setup: Python | 3.10.4, PyQt6 | 6.3.2, macos Monterey 12.4
Solution
I found the solution / a workaround. Running the application through a system terminal (or telling Spyder to do it in Preferences>Run>Console) makes the program exit correctly without having to force quit it every time.
Answered By - undecimal
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.