The class watchdog.observers.Observer
inherits from threading.Thread
, so the actual checking is done in a thread that you start when you call observer.start()
.
The loop doesn't do anything except letting the program run until the user interrupts it. You can remove it completely and run the Qt event loop as usual:
observer.start()
status = app.exec_()
observer.stop()
observer.join()
sys.exit(status)