title: How to display images inside the new tab in Python
body: <p>Suppose that I have 10 images in a directory, and need them to be displayed inside a newly created tab once the user presses a push-button. The images must be displayed according to a 5x5 grid with a proper image label. </p>
  
  <p>I have designed a GUI using Qt Designer containing three different tabs (tab1, tab2 and tab3), but it seems like this will not work for me - the images wouldn't display inside tab3. How can I make it done by using command-line coding rather than using Qt Designer in order to display all the images?</p>
  
  <p>Below is the function to display the images:</p>
  
  <pre><code># Display image at 'Tab 3' once user press button 'Display'
  def display_result(self):
  
      # Get wafer qty
      qty = int(self.qty_selected)
      print('qty -&gt; ' + str(qty))
  
      # Get lot id
      name = str(self.lotId)
      print ('lotId -&gt; ' + str(name))
  
      for index in range(int(qty)):   
          pixmap = QtGui.QPixmap()
          path = r'c:\Users\mohd_faizal4\Desktop\Python\Testing\%s\%s_%d.jpeg' % (name, name, index + 1)
          print('load (%s) %r' % (pixmap.load(path), path))
          item = QtGui.QListWidgetItem(os.path.basename(path))
          item.setIcon(QtGui.QIcon(path))
          self.viewer.addItem(item)
  
  
      contents = QtGui.QWidget(self.tabWidget)
      layout = QtGui.QVBoxLayout(contents)
      self.tabWidget.addTab(contents, 'Tab 4')
  </code></pre>
  
  <p>I would like to display all the images inside 'Tab 4', instead of opening a another window.</p>
  
  <p><a href="https://i.stack.imgur.com/TcMm3.jpg" rel="nofollow"><img src="https://i.stack.imgur.com/TcMm3.jpg" alt="tab 3"></a>      </p>