Интерактивное push-уведомление Python

Всем привет. Возник вопрос. У меня есть код

import win10toast
import time
import os
import glob
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
src="D:/temp"
toaster = win10toast.ToastNotifier()


def on_modified(event):
    list_of_files = glob.glob(src + "/*")  #main folder date (Name of a folder is date)
    latest_file = max(list_of_files, key=os.path.getctime)
    print(latest_file)

    list_of_files1=glob.glob(latest_file + "/*") # folder Surname of exporter(Surname of employee)
    print(list_of_files1)
    latest_file1=max(list_of_files1, key=os.path.getctime)

    list_of_files2 = glob.glob(latest_file1 + "/*")  #File(Created Files)
    latest_file2 = max(list_of_files2, key=os.path.getctime)
    print(list_of_files2)
    toaster.show_toast("OBj created", time.asctime()+'  '+ latest_file1[len(latest_file) + 1:] + " export " + latest_file2[len(latest_file1) + 1:] + " In path " + latest_file[len(src) + 1:],duration=10)

if __name__=='__main__':

    event_handler = FileSystemEventHandler()
    event_handler.on_modified=on_modified
    observer = Observer()
    observer.schedule(event_handler, src, recursive=True)
    observer.start()

try:
    print('Start')
    while True:
        time.sleep(1)
except KeyboardInterrupt:
    observer.stop()

    observer.join()
    print('Stop')

Программа выводит изменения в папках в виде уведомлений. Как сделать так, чтобы уведомление стало интерактивным(При нажатии на уведомление открывалась папка с измененным файлом)?


Ответы (0 шт):