[Tkinter-discuss] non-GUI event detection in Tkinter mainloop()

O'Gorman, Lawrence (Larry) larry.ogorman at alcatel-lucent.com
Wed May 20 00:08:03 CEST 2009


I'm trying to figure out if Python and Tkinter can offer a solution to
my following problem. I want to monitor a file and when that file is
changed, I want to detect that event and have my window change its text
from "File Unchanged" to "File has Changed." 

 

That is, I can produce a function to periodically sample the
modification time of a file and if it is different than my last sample
time, then this function will return an indication that the file is
changed. I want this file-change event to be captured by the tkinit
mainloop(), which I will then use to change the appearance of my window.


 

I understand that any GUI event (mouse, keyboard, etc.) can be detected
in the mainloop(), but I have seen no indication in the documentation
and discussions that a file-change can produce an event that can be
detected in the mainloop(). Does anyone know if I can do this? If so,
how? Or, if there is an alternative way than mainloop() to get a window
to change upon a file-change, that would be helpful, too.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20090519/e48916ac/attachment.htm>


More information about the Tkinter-discuss mailing list