title: How do I set an Icon for a Qpushbutton in a GUI with placeholders in Qt Designer?
body: <p><strong>Solution:</strong><br>
  My fault: The file where adding the icon to the button is used via the "placeholder" function from QtDesigner. The Main-programm located in a different folder searches in its own folder for the icon, not in the folder from the "imported" file. So you just have to add the path to the icon:</p>
  
  <pre><code>dirpath = os.path.dirname(os.path.abspath(__file__))
  icon1_path = os.path.join(dirpath,"arrow_down.ico")
  icon = QtGui.QPixmap(icon1_path)
  </code></pre>
  
  <hr>
  
  <p>I want to create a Qpushbutton with an Icon instead of text:</p>
  
  <pre><code>icon = QtGui.QIcon()
  icon.addPixmap(QtGui.QPixmap("arrow_down.png"))
  self.ui.pb_down.setIcon(icon)
  </code></pre>
  
  <p>But this doesn't work. Neither this works:</p>
  
  <pre><code>self.ui.pb_down.setIcon(QtGui.QIcon("arrow_down.png"))
  </code></pre>
  
  <p>Theres is no Error-message, the icon just doesn't appear.</p>
  
  <p>If I add the Icon via Qt Designer, the icon is shown in the Qt Desiger itself, but when running the programm, the icon disappears again. Does anybody know what's going on?</p>
  
  <p>Im using python 2.7 and Windows 7</p>
  
  <p><strong>Edit:</strong>
  Using @Chris Aung code, I get a button with icon.</p>
  
  <pre><code>    button = QtGui.QPushButton()
      self.setCentralWidget(button)
      icon = QtGui.QIcon()
      icon.addPixmap(QtGui.QPixmap("arrow_down.ico"))
      print button.icon().isNull()  #Returns true if the icon is empty; otherwise returns false.
      #output = False
  </code></pre>
  
  <p>But if I use exactly this code in my GUI, it just doesnt add the icon. </p>
  
  <pre><code>    icon = QtGui.QIcon()
      icon.addPixmap(QtGui.QPixmap("arrow_down.ico"))
      self.ui.pb_down.setIcon(icon)
      print self.ui.pb_down.icon().isNull()
      # output = True
  </code></pre>
  
  <p>I have no idea where the problem is.</p>