Details
-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
6.0.2
-
None
-
PySide 6.0.2
Python 3.8.8
Windows 10 build 19042.804
Description
I do quite a bit of prototyping from Jupyter Lab. It is important to me that Jupyter remains interactive while I manipulate widgets that I am developing, or widgets that I am using to manipulate my data. In order for that to happen, Jupyter needs the main thread. And so, I run my QApplication from a QThread.
I've noticed when clicking the window close button (top right 'X') that my windows do not close. So far, I've established that closeEvent() is not getting called. On the other hand, if QApplication.exec_() is called from the main thread, they close just fine. I think this is a bug in the widget (gui) event handling system. (I've confirmed that it does this even if I'm not running from Jupyter, just to rule that out.)
It's my understanding that QApplication prefers the main thread, but shouldn't need it. (It issues a warning to the console, but seems to work.) If that is the case, then this is a bug. Otherwise, consider this a feature request.
This closes fine:
from PySide6 import QtWidgets
app = QtWidgets.QApplication()
label = QtWidgets.QLabel('Hello World')
label.show()
app.exec_()
This does not close:
from time import sleep
from PySide6 import QtCore, QtWidgets
class ExampleThread (QtCore.QThread):
def run(self) :
app = QtWidgets.QApplication()
label = QtWidgets.QLabel('Hello World')
label.show()
app.exec_()
example = ExampleThread()
example.start()
sleep (7*24*60*60)
Attachments
Issue Links
- relates to
-
PYSIDE-769 Qt for Python asynchronous support
- Open