Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How to run 2 buttons in parallel in Perl/Tk

by zentara (Archbishop)
on Jun 30, 2014 at 09:36 UTC ( [id://1091688]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1091688]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-19 20:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found