in reply to How to run 2 buttons in parallel in Perl/Tk

You are creating threads after you invoked some Tk gui code. Tk is not threadsafe, and you cannot make threads that way. See Re: Perl Tk and Threads or you can switch to Gtk2 which allows your type of code, with some restrictions.

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh
  • Comment on Re: How to run 2 buttons in parallel in Perl/Tk

Replies are listed 'Best First'.
Re^2: How to run 2 buttons in parallel in Perl/Tk
by Janish (Sexton) on Jul 01, 2014 at 01:12 UTC

    Hi Zentara, thanks for your answer, again. May I know how do people usually do if they want to kick run numerous job together? Seems that the treads method not suitable here, and I doubt to switch to Gtk2 now since my code now is pretty done except for this "RunAll" button :(

      You can use threads made before any gui code is called, and send commands to be eval'd by them thru threads:shared variables. See Tk-with-worker-threads

      The alternative, is to fork off your parallel processes, and that is the way it was originally done before the coming of perl threads.


      I'm not really a human, but I play one on earth.
      Old Perl Programmer Haiku ................... flash japh