How to keep updating QTextEdit from log file
-
I have a log file that keeps on growing. I want the QTextEdit to show the progress in log like tail -f command. I'm using pyqt
i've tried this
self.logpath = os.path.join(os.getcwd(), logfolder, fec_log.txt)
fs_watcher= QFileSystemWatcher()
fs_watcher.addPath(self.logpath)
fs_watcher.fileChanged.connect(self.logWatcher)def logWatcher(self):
file = open(logpath)
self. textedit.append(file.readline())i know this has a problem that it wouldn;t actually seem like streaming the logfile but it keeps reloading the file. But even that doesnt happen. logWatcher slot doesn get called, What could be the problem
-
Hi and welcome to devnet,
IIRC, QSocketNotifier is a better choice for such activities
-
Thanks. Wil try and update
-
Hi,
I'm lost here. I'm on windows. How do i get the socket fd which is required argument for QSocketNotifier().
-
Using
QFile::handle
5/5