title: PyQt5 and subprocess.Popen(...)
body: <p>I have 3 classes</p>
  <p>One is the <code>Console</code> class:</p>
  <pre><code>class Console(QWidget):
      def __init__(self):
          super().__init__()
          self.editor = QPlainTextEdit(self)
          self.editor.setReadOnly(True)
          self.font = QFont()
          self.font.setFamily(editor[&quot;editorFont&quot;])
          self.font.setPointSize(12)
          self.layout = QVBoxLayout()
          self.layout.addWidget(self.editor, 1)
          self.setLayout(self.layout)
          self.output = None
          self.error = None
          self.editor.setFont(self.font)
  
      def run(self, command):
          &quot;&quot;&quot;Executes a system command.&quot;&quot;&quot;
  
          out, err = subprocess.Popen(command, shell=True,    stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
          self.output = out
          self.error = err
          self.editor.setPlainText((self.output + self.error).decode())
          return self.output + self.error
  </code></pre>
  <p>The other one is a <code>Tabs</code> class which assigns <code>Console()</code> to the variable <code>self.console</code>.</p>
  <p>And then I have the <code>Main</code> class which has a function called <code>Terminal</code> which can be called by a keyboard shortcut Shift+F10</p>
  <p>That will take the current filename of the file opened (this is handled with the <code>Tabs</code> class) and run it using <code>subprocess</code>.</p>
  <p>Now we get to the problem: when running some programs that aren't instant, the whole GUI freezes and I can't figure out how to make the GUI responsive when the <code>Console</code> class has executed the <code>run</code> function.</p>
  <p>The whole code can be found here: <a href="https://github.com/Fuchsiaff/PyPad" rel="nofollow noreferrer">https://github.com/Fuchsiaff/PyPad</a></p>