title: Python PyQt5 Qtextbrowser Serial Terminal Overwrite Time Loop on the same line
body: <p>This is what my devices print out on the terminal while waiting for commands(ser.write)</p>
  <p><img src="https://i.stack.imgur.com/iqydO.png" alt="Image of terminal output" /></p>
  <p>I am writing a simple PYQT5 terminal in python to display information on a terminal from a connected device using Qserial.</p>
  <p>The output from the connected device always begins with a time stamp in a similar format which displays every second but on a newline each time thereby flooding the whole Qtextbrowser Terminal.</p>
  <p>this makes it difficult to communicate with the device since this line prints every seconds even if I interrupt it with a command, the command executes successfully and hen the time loops continues again.
  Is there a way to overwrite this loop so that it prints only on the first line all the time without going to next line.</p>
  <p>beneath is a snippet from my script.
  self.Terminal = QTextBrowser()</p>
  <pre><code>  def read_serial(self):
      b = bytes(self.serialport.readAll())
      try:
          read_all = b.decode(&quot;utf-8&quot;)
  
          try:
              lastline = self.Terminal.toPlainText().split(&quot;\n&quot;)[-1]
  
              read_all_nodate = re.sub(r&quot;\d{2}/\d{2}/\d{4} \d{2}:\d{2}:\d{2}&quot;, &quot;&quot;, read_all)
              last_line_nodate = re.sub(r&quot;\d{2}/\d{2}/\d{4} \d{2}:\d{2}:\d{2}&quot;, &quot;&quot;, lastline)
  
              if read_all_nodate == last_line_nodate:
                  cursor = self.Terminal.textCursor()
                  cursor.movePosition(QTextCursor.End)
                  cursor.movePosition(QTextCursor.StartOfLine, QTextCursor.KeepAnchor)
                  cursor.removeSelectedText()
                  self.Terminal.setTextCursor(cursor)
  
          except:
              pass
  
          #read_all = read_all.replace(&quot;\r&quot;, &quot;&quot;)
          self.Terminal.moveCursor(QTextCursor.End)
          self.Terminal.insertPlainText(read_all)
  
      except UnicodeDecodeError:
          read_all = str(b)[2:-1]
  </code></pre>
  <p>Any help will be really appreciated. Thank you.</p>
  <p>Using Terminals like Tera Term and Putty solves the problem because these Terminals prints only on the first line each second there is a time loop output from my device without moving to the next line.</p>
  <p><a href="https://i.stack.imgur.com/79V0J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/79V0J.png" alt="This is a terminal display from tera term" /></a></p>