title: PyQt5: Want to start a specific subprocess with a button click
body: <p>One day old in terms of experience with PyQT, I followed sample code <a href="http://codeprogress.com/python/libraries/pyqt/showPyQTExample.php?index=408&amp;key=QTextEditRedStdOutput&amp;version=5" rel="nofollow noreferrer">HERE</a> to do this, but I am clueless as to how I could separate the start download part from the start GUI part, so that I can instead start that when I press the OK (startBtn)button. Also, know the command I do doesn't do anything but give you an error, but I know that works.<br>
  Any help appreciated!</p>
  
  <pre><code>from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow, QAction, qApp, QDesktopWidget, QPushButton, QHBoxLayout, QVBoxLayout, QTextEdit
  from PyQt5.QtGui import QIcon
  from PyQt5.QtCore import QThread, QProcess
  import sys
  
  
  class GUI(QProcess):
      def __init__(self):
          super().__init__()
  
          # Create an instance variable here (of type QTextEdit)
          startBtn = QPushButton('OK')
          stopBtn = QPushButton('Cancel')
  
          #startBtn.clicked.connect()
          stopBtn.clicked.connect(qApp.exit)
  
          self.hbox = QHBoxLayout()
          self.hbox.addStretch(1)
          self.hbox.addWidget(startBtn)
          self.hbox.addWidget(stopBtn)
          self.edit = QTextEdit()
  
          self.edit.setWindowTitle("QTextEdit Standard Output Redirection")
  
          self.vbox = QVBoxLayout()
          self.vbox.addStretch(1)
          self.vbox.addWidget(self.edit)
          self.vbox.addLayout(self.hbox)
  
          #setLayout(self.vbox)
          self.central=QWidget()
  
          #self.vbox.addWidget(self.edit)
          self.central.setLayout(self.vbox)
          self.central.show()
  
      def readStdOutput(self):
          self.edit.append(str(self.readAllStandardOutput()))
  
  
  
  
  def main():
      app = QApplication(sys.argv)
      qProcess = GUI()
  
      qProcess.setProcessChannelMode(QProcess.MergedChannels);
      qProcess.start("youtube-dl")
      qProcess.readyReadStandardOutput.connect(qProcess.readStdOutput);
  
      return app.exec_()
  
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>2 notes: </p>
  
  <ol>
  <li><p>If you also know how to disable the OK button when you press it, until the process is finished, then I'd love to know. </p></li>
  <li><p>Not all imports are used, but I can clean that later. PyCharm show which is used and not. Cleanup is for later. </p></li>
  </ol>