Python qt designer持续构建的GUI的更新值

Python qt designer持续构建的GUI的更新值,python,ubuntu,qt-designer,Python,Ubuntu,Qt Designer,我正在ubuntu系统中使用qt4。 我有一个文本文件,需要在GUI中查看。但问题是我的文本文件会不断自动更新。如何在更新文本文件时更新GUI中的值 这是我的节目: #!/usr/bin/python import os,getpass import sys import time from subprocess import call import subprocess userName=getpass.getuser() from PyQt4 import QtCore, QtGui tr

我正在ubuntu系统中使用qt4。 我有一个文本文件,需要在GUI中查看。但问题是我的文本文件会不断自动更新。如何在更新文本文件时更新GUI中的值

这是我的节目:

#!/usr/bin/python
import os,getpass
import sys
import time
from subprocess import call
import subprocess
userName=getpass.getuser()
from PyQt4 import QtCore, QtGui

try:
  _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
  _fromUtf8 = lambda s: s

class Ui_MainWindow(object):
  def setupUi(self, MainWindow):
    MainWindow.setObjectName(_fromUtf8("MainWindow"))
    MainWindow.resize(455, 317)
    self.centralwidget = QtGui.QWidget(MainWindow)
    self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
    self.textBrowser = QtGui.QTextBrowser(self.centralwidget)
    self.textBrowser.setGeometry(QtCore.QRect(10, 80, 431, 141))
    self.textBrowser.setSource(QtCore.QUrl(_fromUtf8("file:///home/"+userName+"/updated.txt")))
    self.textBrowser.setObjectName(_fromUtf8("textBrowser"))
    self.label = QtGui.QLabel(self.centralwidget)
    self.label.setGeometry(QtCore.QRect(20, 20, 621, 71))
    font = QtGui.QFont()
    font.setPointSize(24)
    font.setBold(True)
    font.setItalic(True)
    font.setWeight(75)
    self.label.setFont(font)
    self.label.setObjectName(_fromUtf8("label"))
    MainWindow.setCentralWidget(self.centralwidget)
    self.menubar = QtGui.QMenuBar(MainWindow)
    self.menubar.setGeometry(QtCore.QRect(0, 0, 455, 25))
    self.menubar.setObjectName(_fromUtf8("menubar"))
    MainWindow.setMenuBar(self.menubar)
    self.statusbar = QtGui.QStatusBar(MainWindow)
    self.statusbar.setObjectName(_fromUtf8("statusbar"))
    MainWindow.setStatusBar(self.statusbar)

    self.retranslateUi(MainWindow)
    QtCore.QMetaObject.connectSlotsByName(MainWindow)

def retranslateUi(self, MainWindow):
    MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8))
    self.label.setText(QtGui.QApplication.translate("MainWindow", "Some Program", None, QtGui.QApplication.UnicodeUTF8))


if __name__ == "__main__":
  import sys
  app = QtGui.QApplication(sys.argv)
  MainWindow = QtGui.QMainWindow()
  ui = Ui_MainWindow()
  ui.setupUi(MainWindow)
  MainWindow.show()
  sys.exit(app.exec_())

查找QFileSystemWatcher。你知道如何读取文件、检查文件的修改时间并设置计时器定期检查吗?我刚从qt Designer添加了源代码updated.txt,但我不知道如何读取文件并将其与GUI链接..因为我正在使用Python。。。在qt4上很难找到任何帮助。。。是否有任何视频或pdf作为教程??