---- '''[sillymonkeysoftware] - 2011-02-12 16:42:49''' Hi Folks, I'm having a bit of difficulty implementing the simple GUI keep-alive as described above. My program needs to calculate and export large chunks of audio data. If I do it in a while-loop I get a frozen gui and spinning beach ball (Mac) until everything completes. Really not what I want the users to suffer through, and there's no way to halt it once it's begun. I was thrilled when I found the examples above. So here's what I initially tried, but it seems to only export one iteration of the loop, then returns: ` proc export_loop {} { set ::gExportStatus [continue_export] if {$::gExportStatus > 0} { after idle [list after 0 export_loop] } return } export_loop ` So, after numerous attempts to get the above working, I'm now using this: ` set ::gExportStatus 1 while {$::gExportStatus > 0} { update idletasks after idle [dict get $gInterface progress_bar] configure -value $::gExportStatus set ::gExportStatus [continue_export] } ` which seems, well... hideous. and is only slightly better than the spinning beach ball frozen gui. There's still no way to actually catch a halt from a button press and stop the export. Now, `continue_export` is acutally a C function that returns: * The number of frames that were exported. * A zero if all frames have exported and there is nothing left to do. * A negative number if there was an error during export. Is the problem that I'm throwing the call to the C function in the middle of the proc? Any thoughts?