jeudi 10 mars 2016

printing data on gui from database python

I am very new to python and I have created a database in sqlite that records the time when files are copied from one folder to another. I am trying to have my GUI say "Files last transferred on: ____" and to fill the blank with the last date recorded. I am able to print the last record with this code:

def lastInsert():
   sql_str = "SELECT DATETIMES from TRANSFER_TIMES ORDER BY ID DESC LIMIT 1;"
   cursor = conn.execute(sql_str)
   lastrow = cursor.fetchall()
   print lastrow

which prints:

[(u'2016-03-09 17:53:02.537000',)]

But I cannot for the life of me figure out how to get that time stamp to fill in the blank on my GUI. I am using wxpython. It would also be great if i could get it out of unicode.

Aucun commentaire:

Enregistrer un commentaire