Monitoring updating directory for image for GUI

ciscorucinski at gmail.com ciscorucinski at gmail.com
Mon Feb 11 23:50:42 CET 2013


WOW...I am thinking that all of this was actually unnecessary, I don't think I need a Queue, or List / Stack, or any traversal of the file system to accomplish this!!

I only need one image displayed at a time and don't care about them after a newer image is generated. So my prototype of just replacing the image over and over again SHOULD suffice. All I need the for the "monitor" now is to grab the image file (that might have or might not have been updated by Lilypond) at set amount of times and refresh the GtkImage object.

The only reason why I originally suggested using multiple files was because I wanted to make sure that I had to most recent image and I was not sure if the threads would guarantee that. So my only remaining question (for now) is...

I'm I guaranteed that if I have threads 1...n, that were all started in **quick** succession to call an OS command on Lilypond, that if I replaced the image file being generated with the completion of each thread that I would end up with the final image being from thread n...and that if I were able to update the GUI in a fast enough fashion, that I would see the images being displayed on the screen from 1 to n without anything being out of place?

All of my tests have shown that seems to be a reasonable assumption, but I need to know for sure. If that was the case were I am not guaranteed that, then when a user decides to stop the stream I could resend the note stream that I have saved on my end to Lilypond one last time to guarantee that all of the notes are displayed.


So I would only create one image location at "images\sheetMusic.png" and that file would be continuously updated as new notes are streamed in. My "monitor" class (might be a legacy component now) would basically look for that one image - "images\sheetMusic.png", grab it, and update the GUI at an interval that is easy on the eyes (maybe a half second for example).

Could there be a problem where the image is being updated, so the OS deletes the image, and my program tries to update the image but cannot find it, and the OS reassigns that file location to that previous file location and name?

Let me know what you thing or if anything is confusing you.
Thanks for the comments so far!

 - Christopher - 



More information about the Python-list mailing list