-
Type:
Bug
-
Status: Closed
-
Priority:
P1: Critical
-
Resolution: Fixed
-
Affects Version/s: 5.11.1
-
Fix Version/s: 5.14.2
-
Component/s: PySide
-
Labels:None
-
Environment:Python 3.6, PySide2 5.11.1, PyQt5 5.11.2. This problem would occur in both Linux (Kubuntu 18.04.1) and Windows 10 (so far as I have tested).
-
Platform/s:
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.
- is related to
-
PYSIDE-1108 Improve handling of threading issues between Python and Qt world
-
- Open
-
- is required for
-
PYSIDE-1203 Documentation/Examples For How To Develop Multithreaded Applications
-
- Reported
-
- mentioned in
-
Page Loading...