Bonjour à tous,

Je bloque sur un petit soucie d'affichage d'un QtableWidget.
Je charge des données d'une pas de données qui sont deux string et trois réels. Le soucie est que je ne peux que mettre des str dans un QtqbleWidget car sinon les items ne s'affichent pas.
Voici le bout de code concerné :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
        self.proj_selected = self.tableWidget_ListProj.item(row, col).text()
        try:
            conn = psycopg2.connect("dbname='qgis_db' user='postgres' host='localhost' password='postgresql'")
        except:
            print "I am unable to connect to the database"
        cur = conn.cursor()        
        self.dataProj= cur.execute(" SELECT pt_projname,pt_projnum, pt_x,pt_y,pt_z FROM point where pt_projname ='%s';"%(self.proj_selected))
        self.dataProj = cur.fetchall()
        for i in self.dataProj :
            for j in i :
                j= str(j)
                self.dataProj.append(j)
        print self.dataProj
        lignes = len(self.dataProj)
        columns =5
        i = 0
        j = 0
        self.tableWidget_DisplayProj.setRowCount(lignes)
        self.tableWidget_DisplayProj.setColumnCount(columns)
        self.tableWidget_DisplayProj.setHorizontalHeaderLabels(['name', 'num','x','y','z'])
        self.tableWidget_DisplayProj.horizontalHeader().setResizeMode(0, QHeaderView.Stretch)
 
        for i in range(lignes):
            for j in range(columns):
                item = QtGui.QTableWidgetItem(self.dataProj[i][j])
                self.tableprojet = self.tableWidget_DisplayProj.setItem(i, j, item)
Le soucie se situe à la partie censé transformer tous les élements de ma liste en str:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
for i in self.dataProj :
            for j in i :
                j= str(j)
                self.dataProj.append(j)
Mon code plante et plus rien ne répond. Je ne dois pas bien m'y prendre et je ne vois pas comment contourner ce problème. Auriez vous une idée ?

Pour remplacer l'importation de postgis voici un jeu de donnée si nécessaire :
(pt_projname, pt_projnum, pt_x, pt_y, pt_z)
('STG Ahlsdorf', '4250 05 03115 67', 4579336, 5744309, 79.4)
('STG Ahlsdorf', '4250 05 03115 67', 4579219, 5744142, 79.2)

Merci d'avance pour vôtre aide !