Hi Lawrence,

File system events are not a part of tk library so Tkinter doesn't process
such events.
Nevertheless native _tkinter library contains two file event related
procedures - createfilehandler() and deletefilehandler()
So you can try finding samples how to use these functions. For example:

http://mail.python.org/pipermail/python-list/1999-May/001838.html

Also you can try resolving this issue using "fileevent" tcl command:

http://www.tcl.tk/man/tcl8.5/TclCmd/fileevent.htm

But this way supposes tcl programming.

Regards,

Igor Novikov
sK1 Project
http://sk1project.org

On Wed, May 20, 2009 at 1:08 AM, O'Gorman, Lawrence (Larry) <
larry.ogor...@alcatel-lucent.com> wrote:

>  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.
>
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss@python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
>
>
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to