Details
Description
It is not completely freezing. However, when I do some heavy tasks in QThread, the GUI responds slowly. For instance,
import sys from PySide2.QtCore import QThread from PySide2.QtWidgets import (QApplication, QWidget, QPushButton, QComboBox, QVBoxLayout) class Task(QThread): def run(self): # some heavy tasks print('task started') k = 0 for i in range(10000): for j in range(50000): k += 1 print('task finished') class Gui(QWidget): def __init__(self): super().__init__() layout = QVBoxLayout() button = QPushButton('click me') button.clicked.connect(self.do_task) combobox = QComboBox() combobox.addItems(['1', '2', '3', '4', '5']) layout.addWidget(button) layout.addWidget(combobox) self.setLayout(layout) def do_task(self): self.thread = Task() self.thread.start() if __name__ == '__main__': app = QApplication(sys.argv) window = Gui() window.show() sys.exit(app.exec_())
Here is the example GIF animation.
However, if I use PyQt5 to run the script (replacing PySide2 module), the GUI response will not delay at all.
Attachments
Issue Links
- is required for
-
PYSIDE-1203 Documentation/Examples For How To Develop Multithreaded Applications
- Reported
- relates to
-
PYSIDE-1108 Improve handling of threading issues between Python and Qt world
- Closed
-
PYSIDE-1657 Possible deadlock on signal connect/emit
- Closed
-
PYSIDE-1919 Segfault when garbage collector grabs object with connected signal
- Closed
-
PYSIDE-2034 QMessageBox.information in main thread blocks worker thread.
- Closed
-
PYSIDE-2302 QThreadPool locking main thread when creating QImage in PySide2 and PySide6
- Closed
-
PYSIDE-1788 overriden methods should allow threads during long Qt operations
- Closed
- resulted in
-
PYSIDE-1681 GIL deadlock in qInstallMessageHandler
- Closed
- mentioned in
-
Page Loading...
For Gerrit Dashboard: PYSIDE-803 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
251714,2 | Unify The Function Formatting In Generated Code | 5.12 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
286739,6 | WIP: Lock -free Check for overridden methods | 5.15 | pyside/pyside-setup | Status: ABANDONED | -2 | 0 |
286952,7 | shiboken: Refactor writing of get/setattro methods | 5.15 | pyside/pyside-setup | Status: ABANDONED | +2 | 0 |
287746,32 | Avoid the GIL in non-overridden Methods | 5.14 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
288077,5 | WIP: Trace bug PYSIDE-803 by full instrumentation | 5.15 | pyside/pyside-setup | Status: ABANDONED | -2 | 0 |
289606,8 | Adjust the allow-thread behavior | 5.14 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
289900,2 | shiboken: Refactor writing of get/setattro methods | 5.14 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
291267,3 | Replace the GilState by a Stackless Variant | 5.14 | pyside/pyside-setup | Status: ABANDONED | 0 | 0 |
291482,2 | WIP: Replace the GilState by a Lazy Variant | 5.14 | pyside/pyside-setup | Status: ABANDONED | -2 | 0 |
291505,10 | Change the default of allow-thread to false | 5.14 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
292143,9 | Delay releasing the GIL until really needed | 5.14 | pyside/pyside-setup | Status: ABANDONED | 0 | 0 |
292288,3 | Error: Avoid the GIL in non-overridden Methods | 5.14 | pyside/pyside-setup | Status: ABANDONED | 0 | 0 |
292552,2 | Add a parameter to the Shiboken::GilState class | 5.14 | pyside/pyside-setup | Status: ABANDONED | 0 | 0 |
292721,3 | shiboken: Add XML attribute to turn off method caching | 5.14 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
292815,2 | WIP: Cache overridden methods | 5.14 | pyside/pyside-setup | Status: ABANDONED | -2 | 0 |
293094,5 | Avoid the GIL in SignalManager::retrieveMetaObject | 5.14 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
295595,7 | shiboken: Fix dict access without GIL | 5.14 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
296174,7 | shiboken: Fix Qt properties not working in classes inheriting QObject | 5.14 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
296253,5 | Revert "shiboken: Add XML attribute to turn off method caching" | 5.14 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
304879,4 | shiboken2: Refactor wrapper method generation | 5.15 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
380177,2 | Allow threads in QtGui.QTextDocument.print_ | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
380239,2 | Allow threads in QtGui.QTextDocument.print_ | 6.2 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
380242,3 | Allow threads in QtGui.QTextDocument.print_ | tqtc/lts-5.15 | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |
428369,3 | Fix blocking threads in static functions of QMessageBox | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
428544,2 | Fix blocking threads in static functions of QMessageBox | 6.3 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
428545,2 | Fix blocking threads in static functions of QMessageBox | tqtc/lts-6.2 | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |
428546,3 | Fix blocking threads in static functions of QMessageBox | tqtc/lts-5.15 | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |
472935,4 | Fix image loading from a thread blocking the UI | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
473125,2 | Fix image loading from a thread blocking the UI | 6.5 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
473479,1 | Fix image loading from a thread blocking the UI | tqtc/dev | pyside/tqtc-pyside-setup | Status: ABANDONED | 0 | 0 |