Details

    • Type: Bug
    • Status: In Progress
    • Priority: P1: Critical
    • Resolution: Unresolved
    • Affects Version/s: 5.11.1
    • Fix Version/s: None
    • 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:
      All

      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

        1. 0a37ffb2-0552-450b-9b6f-884dc0b15a4e.gif
          0a37ffb2-0552-450b-9b6f-884dc0b15a4e.gif
          77 kB
        2. e5e5cbd1-e2e7-40a6-9e43-0de516e5acc6.gif
          e5e5cbd1-e2e7-40a6-9e43-0de516e5acc6.gif
          98 kB
        3. pyside803_print_workaround.py
          1 kB
        4. pyside803.py
          1 kB
        5. pyside803plus.py
          2 kB
        6. pyside803pyqt.py
          1 kB

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              • Assignee:
                ctismer Christian Tismer
                Reporter:
                alan13wake Sean Wu
              • Votes:
                4 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes