我有应用程序检查日期(linux)并将此'日期'放入单元格'a1'。 如何在应用程序运行一分钟后刷新单元格'a1'? 将来我将刷新下面列出的所有单元格,但在开始时很好知道如何刷新第一个单元格;] 应用程序将在linux(而不是Windows)下运行。
import sys
import os
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4 import QtCore, QtGui
#!/usr/bin/python
a1 = os.popen("date")
a1 = a1.read()
data = {'date':['%s'%a1,'a2','a3'], 'x1':['b1','b2','b3'], 'x2':['c1','c2','c3'], 'x3':['d1','d2','d3'], 'x4':['e1','e2','e3'], 'min':['f1','f2','f3'], 'x5':['g1','g2','g3'], 'x6':['h1','h2','h3']}
class MyTable(QTableWidget):
def __init__(self, data, *args):
QTableWidget.__init__(self, *args)
self.data = data
self.setmydata()
self.resizeColumnsToContents()
self.resizeRowsToContents()
def setmydata(self):
horHeaders = []
for n, key in enumerate(sorted(self.data.keys())):
horHeaders.append(key)
for m, item in enumerate(self.data[key]):
newitem = QTableWidgetItem(item)
self.setItem(m, n, newitem)
self.setHorizontalHeaderLabels(horHeaders)
def main(args):
app = QApplication(args)
table = MyTable(data, 5, 8)
table.show()
sys.exit(app.exec_())
if __name__=="__main__":
main(sys.argv)