title: Problems with string formatting using PyQT5 and Python
body: <p>I would like to format nicely some text lines in a textbox. Of course I wanted to use string formatting but unfortunately something went wrong and I really don't know where.</p>
  
  <p>That's my code which creates a window with a textbox and some "formatted" lines in it.</p>
  
  <pre><code>import sys
  from PyQt5 import QtCore, QtWidgets
  from PyQt5.QtWidgets import * 
  from PyQt5.QtCore import pyqtSlot, QSize, QRect
  
  class PrintWindow(QMainWindow):
  
      def __init__(self):
          super().__init__()
          self.title='Print something'
          self.left=10
          self.top=10
          self.width=640
          self.height=480
          self.initUI()
  
      def initUI(self):
          self.setWindowTitle(self.title)
          self.setGeometry(self.left,self.top,self.width,self.height)
  
          self.statusBar().showMessage('In progress')
  
          # create textbox
          self.textbox = QTextEdit(self)
          self.textbox.move(50, 210)
          self.textbox.resize(540, 200)
          self.textbox.setReadOnly(True)
          # create textbox done
  
          self.show()
  
          data = []
          line1 = 'Some text'
          line2 = 50 * '-'
          line3 = "{:&lt;10} {:&lt;15} {:&lt;25} {:&lt;25} {:&lt;25}".format('Number:', 'City:', 'Some info:', 'Person:', 'Date:')
          line4 = "{:&lt;10} {:&lt;15} {:&lt;25} {:&lt;25} {:&lt;25}".format('1', 'Dublin', 'Yes', 'Gabriella Anderson', 'No date')
          line5 = "{:&lt;10} {:&lt;15} {:&lt;25} {:&lt;25} {:&lt;25}".format('2', 'London', 'No', 'Daniel Wozniak', '2019-08-08')
          data.append(line1)
          data.append(line2)
          data.append(line3)
          data.append(line4)
          data.append(line5)
          self.textbox.setText("\n".join(data))
  
  if __name__ == '__main__':
  
      app = QApplication(sys.argv)
      window = PrintWindow()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>As I wrote above unfortunately it doesn't work and the window doesn't look nice. 
  <a href="https://i.stack.imgur.com/83DTd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/83DTd.png" alt="Window with a textbox"></a></p>
  
  <p>What is even more interesting I tried with a similar code in normal Python terminal. There it is</p>
  
  <pre><code>data = []
  line1 = 'Some text'
  line2 = 50 * '-'
  line3 = "{:&lt;10} {:&lt;15} {:&lt;25} {:&lt;25} {:&lt;25}".format('Number:', 'City:', 'Some info:', 'Person:', 'Date:')
  line4 = "{:&lt;10} {:&lt;15} {:&lt;25} {:&lt;25} {:&lt;25}".format('1', 'Dublin', 'Yes', 'Gabriella Anderson', 'No date')
  line5 = "{:&lt;10} {:&lt;15} {:&lt;25} {:&lt;25} {:&lt;25}".format('2', 'London', 'No', 'Daniel Wozniak', '2019-08-08')
  data.append(line1)
  data.append(line2)
  data.append(line3)
  data.append(line4)
  data.append(line5)
  
  for element in data:
      print(element)
  </code></pre>
  
  <p>Now the printed lines are perfect and they look as I expected.
  <a href="https://i.stack.imgur.com/bdMeJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bdMeJ.png" alt="Lines in Python terminal"></a></p>
  
  <p>Where is the problem? What am I doing wrong?</p>