title: PyQt5 how to read/write from/to a QProcess
body: <p>I have a PyQt5 GUI application and would like to execute an external program and display stdout, stderr and stdin of the external program on a QTextEdit widget. I have managed to do so for stdout and stderr. I need help for the stdin of the external process.</p>
  
  <p>Imagine the following snippets </p>
  
  <pre><code>       self.te = QTextEdit(self)
         self.te.move(self.x0, 150)
         self.te.resize(self.mainWinWidth - 100, self.mainWinHeight - 200)
  </code></pre>
  
  <p>And the snippet to get QProcess going ...</p>
  
  <pre><code>      self.process = QtCore.QProcess(self)
        self.process.setProcessChannelMode( QProcess.MergedChannels )
        self.process.readyRead.connect(self.readReady)
        # ... and elsewhere I start the sub process like
        os.environ["PYTHONUNBUFFERED"] = "1"
        self.process.start('./goo', [])
  </code></pre>
  
  <p>and readReady() implemented as:</p>
  
  <pre><code>    def readReady(self):
          cursor = self.te.textCursor()
          cursor.movePosition(cursor.End)
          cursor.insertText(str(self.process.readAll(), 'utf-8'))
          self.te.ensureCursorVisible()
  </code></pre>
  
  <p>And goo(1) is a basic sub process implemented as </p>
  
  <pre><code>#!/usr/bin/python3
  
  import time
  import sys
  
  for i in range(0,5):
      print(f"============ {i} ===")
      time.sleep(1)
  
  sys.stderr.write("Testing stderr...\n")
  print("Enter name:")
  name = sys.stdin.readline()
  print(f"Got {name}")
  </code></pre>
  
  <p>With that said, I do see stdout and stderr all working ok. I also see "Enter name:" but when I enter "joe" or "moe" on the QTextEdit, nothing happens, ie the back end sub process is still waiting. </p>
  
  <p>So it seems like I need an event handler for the write. That is when the sub-process (via QProcess) waits for input on its stdin, I need to detect that and somehow read that from QTextEdit (from the user) and then feed that to the sub process (i.e write to its stdin).</p>
  
  <p>Think ssh or telnet or xterm. Isn't there any on the shelf widget for this ? </p>