title: `less +F logfile` in pyqt
body: <p>I'm trying to figure out how to continuously update a text area with loginfo. I have the following (snippet from my code)</p>
  
  <pre><code>import sys 
  import os
  import PyQt4.QtGui as gui 
  import PyQt4.QtCore as core
  
  class ApplicationWindow(gui.QMainWindow):
      ''' 
      Our main application window
      '''
      def __init__(self):
          gui.QMainWindow.__init__(self)
          self.main_widget = gui.QWidget(self)
          l = gui.QHBoxLayout(self.main_widget)
  
          self.te = gui.QPlainTextEdit()
          self.rdock = gui.QDockWidget("Output",self)
          self.rdock.setWidget(self.te)
          self.te.setReadOnly(True)
          self.addDockWidget(core.Qt.RightDockWidgetArea,self.rdock)
  
          self.run_command("less +F test.txt")
          self.main_widget.setFocus()
          self.setCentralWidget(self.main_widget)
  
      def run_command(self,fcmd):
          '''
          Runs our desired command and puts the output into the right dock
          '''
          cmd = str(fcmd)
          stdouterr = os.popen4(cmd)[1].read()
          self.te.setPlainText(stdouterr)
  
  qApp = gui.QApplication(sys.argv)
  aw = ApplicationWindow()
  aw.setWindowTitle("%s" %progname)
  aw.show()
  sys.exit(qApp.exec_())
  </code></pre>
  
  <p>My problem here is that the program hangs. I would like to be able to continuously show the output and eventually I'll want to be able to kill that command and run <code>less +F otherFile.txt</code>. I'm not dedicated to using the <code>less</code> command, I just want to see the continuous tail end of a file.</p>
  
  <p>I have tried using threading, like this, but to no avail</p>
  
  <pre><code>runThread = threading.Thread(target=self.run_command("less +F test.txt"))
  runThread.daemon = True
  runThread.start()
  </code></pre>
  
  <p>I am getting the impression that I need to run the ostream command on a different thread so that I'm not blocking the main application, but am unsure how best to do this.</p>