<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    Le 04/08/11 18:06, Tony Peña a écrit :
    <blockquote
cite="mid:CALBaCduWxzq9Xu6BBcf=Qef4N_-WVyp3Tsa-eGNvy+NSD8ts0w@mail.gmail.com"
      type="cite">Hi i trying set logoimage into cell of QtableWidget
      <div><br>
      </div>
      <div>all code runs ok but can't see the image in the table</div>
      <div><br>
      </div>
      <div>i try with .gif and .png files</div>
      <div><br>
      </div>
      <div>any idea?</div>
      <div><br>
      </div>
      <div>heres the code:</div>
      <div><br>
      </div>
      <div>./airlines/ (many logosfiles in ABC.gif and ABC.png)</div>
      <div>if exist show up ifnot just say the code of aircraft</div>
      <div><br>
      </div>
      <div>
        <div>            code_airline = row[0][:3]</div>
        <div>            airlineCodePath = './airlines/%s.png' %
          code_airline</div>
        <div>            try:</div>
        <div>                if os.path.exists(airlineCodePath) is True:</div>
        <div>                    image =
          QtGui.QIcon(QtGui.QPixmap(airlineCodePath))</div>
        <div>                    airline = QtGui.QTableWidgetItem(image)</div>
        <div>                    airline.setIcon(image)</div>
        <div>                    col_airline =
          QtGui.QTableWidgetItem(airline, 0)</div>
        <div>                    self.ui.PILOT_FullList.Seti(startrow,
          1, code_airline)    </div>
        <div>                else:</div>
        <div>                    code_airline = '-'</div>
        <div>                    col_airline =
          QtGui.QTableWidgetItem(code_airline, 0)</div>
        <div>                   
          self.ui.PILOT_FullList.setItem(startrow, 0, col_airline)   </div>
        <div>            except:</div>
        <div>                pass         </div>
        <div><br>
        </div>
        thanxs any way by all</div>
      <div><br>
      </div>
      <div><br>
        -- <br>
        <font color="#888888"><font color="#888888">Antonio Pe</font><span><font
              color="#888888">ñ</font></span><font color="#888888">a</font><span></span><br>
          <font color="#888888">Secure email with PGP 0x8B021001
            available at <a moz-do-not-send="true"
              href="http://pgp.mit.edu" target="_blank">http://pgp.mit.edu</a><br>
          </font></font><font color="#888888">
          <font color="#888888">Fingerprint: 74E6 2974 B090 366D CE71 
            7BB2 6476 FA09 8B02 1001</font></font><br>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
PyQt mailing list    <a class="moz-txt-link-abbreviated" href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a>
<a class="moz-txt-link-freetext" href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></pre>
    </blockquote>
    Hi,<br>
    <br>
    Your construction is not exact<br>
    <br>
            icon = QtGui.QIcon(QtGui.QPixmap("image_path"))<br>
            item = QtGui.QTableWidgetItem(icon, "")        # Second
    argument (required !) is text<br>
            self.tableWidget.setItem(0, 0, item)<br>
    <br>
    Normaly you should have errors but with your "try: except: pass" ...<br>
    <br>
    <div class="moz-signature">-- <br>
      Vincent V.V.<br>
      <a href="https://launchpad.net/oqapy">Oqapy</a> . <a
        href="https://launchpad.net/qarte+7">Qarte+7</a> . <a
        href="https://launchpad.net/paqager">PaQager</a></div>
  </body>
</html>