I want to design a wxpython ListCtrl. So when the Search button is clicked i am getting list like this
[(7, u'GLUOCOSE', u'C6H1206'), (8, u'SUCROSE', u'C12H22O11')]
I want to populate the listctrl with the above output. I am InsertStringItem method, which will return me the index of current row and rest of the columns are filled by SetStringItem() method.But that gives me TypeError: String or Unicode type required.How do i accomplish this?
def OnSearch(self, event):
placeholder = '?'
placeholders = ','.join(placeholder for unused in self.molecule_list)
query = 'SELECT * FROM MOLECULE WHERE MOL_NUMBER IN (%s)' % placeholders
cursor = self.conn.execute(query, self.molecule_list)
final = cursor.fetchall()
print final
for j in final:
index = self.list.InsertStringItem(sys.maxint, j[0])
self.list.SetStringItem(index, 1, j[1])
self.list.SetStringItem(index, 2, j[2])