pyinotify et gtk ( ou autre "gui" )
bonjour à toutes et à tous,
je tente d'utiliser pyinotify
ça baigne en mode "console" :
Code:
1 2 3 4 5 6 7 8 9
|
import pyinotify
class EventHandler(pyinotify.ProcessEvent):
def process_default(self, event):
print ("Default:",event)
wm=pyinotify.WatchManager()
notifier=pyinotify.Notifier(wm,EventHandler())
wm.add_watch('/tmp',pyinotify.ALL_EVENTS,rec=True)
notifier.loop() |
mais avec gtk3 ( ou qt5 remarquez ! ), rien ne se passe
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
from gi.repository import Gtk
import pyinotify
class EventHandler(pyinotify.ProcessEvent):
def process_default(self, event):
print ("Default:",event)
class MyWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self)
self.set_default_size(200, 100)
self.connect('destroy', Gtk.main_quit)
self.show_all()
wm=pyinotify.WatchManager()
notifier=pyinotify.Notifier(wm,EventHandler())
wm.add_watch('/tmp',pyinotify.ALL_EVENTS,rec=True)
MyWindow()
Gtk.main() |
je commet une erreur où ?
merci d'avance