Click here to Skip to main content
15,561,817 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I am finding it difficult to display retrieved photo varbinary data as a photo (an image). I have a qtablewidget where the retrieved data are stored. The varbinary data gets displayed there. I am coding in Python, managing my database with Microsoft SQL, pyodbc

I have a qformLayout below it where I append the data of the qTablewidget to. Now in the qformlayout, I want the photo to display, not the varbinary text. How do I go about it?

NOTE: I successfully retrieved my all the records and append them in their respective form cell when highlighted, my challenge is displaying the retrieved varbinary data as an image, not byte

What I have tried:

Here are some of the codes I have tried:


for row in rows:
    for col in range(
        itemArray =, col)
        text = "" if itemArray is None else itemArray.text()

         if (col == 14):

passlb = the passport photograph label i.e QLabel("Passport photo")
in my database table, the passport is in column 14, in my qformlayout, the passport is appended in row 12

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900