我用python写了个显示表格的程序,用qt做界面。但如果条目超过10000,就只能显示前4位数字,不知哪位高手能指点一下?
相关程序如下所示:
self.table1 = QTable(self,"table1")
self.table1.setGeometry(QRect(20,60,335,90))
mydb=MySQLdb.Connect(host="localhost", db="test",user="root",passwd="root")
mycursor=mydb.cursor()
stmt="select max(index) from aaa"
mycursor.execute(stmt)
result = mycursor.fetchall()
for record in result:
numEx=record[0]
self.table1.setNumRows(numEx)
self.table1.setNumCols(3)
self.languageChange()
for j in range(3):
stmt="select var"+str(j)+" from aaa where index<="+str(numEx)
#print stmt
mycursor.execute(stmt)
result = mycursor.fetchall()
i=0
for record in result:
x=record[0]
self.table1.setText(i, j, unicode(str(x),'MBCS'))
i +=1