实际上,我正在从mysql数据库中检索图像,图像的偏移代码正在正确检索,该图像为BLOB,但是当需要在标签中显示该图像时,我的程序将停止工作。
cnx = mysql.connector.connect(user='root', password='root', host='localhost', database='ChequeAnalyzer')
cursor = cnx.cursor()
viewdetails = ("Select * FROM chequedetails " "WHERE ChequeNo='%s' "% (''.join(Cheque_Number)))
cursor.execute(viewdetails)
result = cursor.fetchall()
# file_like2 = io.BytesIO(result[0][0])
for row in result:
if row:
print("Cheque No. :", row[0])
print("Branch Name :", row[1])
print("Rupees :", row[2])
print("PKR :", row[3])
print("Pay :", row[4])
print("Signature :", row[5])
print("QR Code :", row[6])
print("image :", row[7]) # Here the offset code of image is printing
print("date :", row[8])
self.ChNo_lineEdit.insert(row[0])
self.BranchName_lineEdit.insert(row[1])
self.Rupees_lineEdit.insert(row[2])
self.PKR_lineEdit.insert(row[3])
self.Pay_lineEdit.insert(row[4])
self.Signature_lineEdit.insert(row[5])
self.QR_lineEdit.insert(row[6])
pixmap=QPixmap.loadFromData(row[7])
self.label_5.setPixmap(pixmap)
self.Date_lineEdit.insert(row[8])
这是label_5的代码
self.label_5 = QtWidgets.QLabel(self.centralwidget)
self.label_5.setGeometry(QtCore.QRect(130, 270, 71, 31))
self.label_5.setObjectName("label_5")
我想在从数据库Here is output of image where offset code is showing检索到的标签中显示图像