diff --git a/bigtext.py b/bigtext.py index 30dd0ce..e2083de 100644 --- a/bigtext.py +++ b/bigtext.py @@ -26,14 +26,16 @@ import threading class FileObserver(FileSystemEventHandler): - counter = 0 + def __init__(self, big_text): super(FileObserver, self).__init__() self.big_text = big_text def on_modified(self, event): - #print("file modified ", self.counter," ", time.time()) - self.counter+=1 + # slow down the updates. This is needed, because the file is modified + # constantly, which would lead to constant re-rendering, which would + # block the UI thread an make the UI unresponsive. + # Note: we don't miss events, because they are queued and de-duplicated time.sleep(0.5) self.big_text.update()