explain the sleep

This commit is contained in:
2021-10-27 18:45:15 +02:00
parent 3319ae4876
commit b61f00ca02

View File

@@ -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()