in reply to Run a batch file and wait for it to finish

use strict; use warnings; use Tkx; use threads; # ... set up your controls $bar->configure( -orient => "horizontal", -mode => "indeterminate", ); $bar->start(); my $thread = threads->create(sub { system("my.bat"); }); $thread->set_thread_exit_only(1); while ($thread->is_running()) { Tkx::update(); } $progress_bar->stop();

I use basically this code to launch an editor so the user can easily alter the configuration file for my program. The new thread allows Tkx to continue to update while waiting for the user to close the editor window. Depending on what you're doing before you launch your thread, you may not be able to join the thread properly. I leave the thread unjoined and ignore the warnings when my program exits, but it's never executing a ton of stuff this way.

There are probably better ways to manage the thread and what it's executing, but I haven't had time to research it. Leaving the thread unjoined doesn't impact me significantly, as the program I'm doing that on exits on completion. The UI is just for the end user to be able to select some files and feed some data in before the process starts.