[PyQt] Trying insert image into QTableWidget

Tony Peña emperor.cu at gmail.com
Thu Aug 4 17:06:14 BST 2011


Hi i trying set logoimage into cell of QtableWidget

all code runs ok but can't see the image in the table

i try with .gif and .png files

any idea?

heres the code:

./airlines/ (many logosfiles in ABC.gif and ABC.png)
if exist show up ifnot just say the code of aircraft

            code_airline = row[0][:3]
            airlineCodePath = './airlines/%s.png' % code_airline
            try:
                if os.path.exists(airlineCodePath) is True:
                    image = QtGui.QIcon(QtGui.QPixmap(airlineCodePath))
                    airline = QtGui.QTableWidgetItem(image)
                    airline.setIcon(image)
                    col_airline = QtGui.QTableWidgetItem(airline, 0)
                    self.ui.PILOT_FullList.Seti(startrow, 1, code_airline)

                else:
                    code_airline = '-'
                    col_airline = QtGui.QTableWidgetItem(code_airline, 0)
                    self.ui.PILOT_FullList.setItem(startrow, 0, col_airline)

            except:
                pass

thanxs any way by all


-- 
Antonio Peña
Secure email with PGP 0x8B021001 available at http://pgp.mit.edu
Fingerprint: 74E6 2974 B090 366D CE71  7BB2 6476 FA09 8B02 1001
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110804/a70dd7cc/attachment.html>


More information about the PyQt mailing list