Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Do I need threading for my GUI?

by BrowserUk (Patriarch)
on Feb 18, 2008 at 14:03 UTC ( #668547=note: print w/replies, xml ) Need Help??


in reply to Do I need threading for my GUI?

Forget what most of the people in this thread have said. Half of them have never used threads, and the other half have never tried their proffered solution in conjunction with Tk.

Take it from someone who has used threads in conjunction with tk. For the scenario you describe, using a thread is by far the simplest solution. Indeed, if you will post (or email to me) the code for your current solution that locks the gui when the "mainprocess" runs, I will convert it to use threads and prevent that, with 3* lines of code.

Let's see any of them offer to convert your existing code to their proffered solution?

*It may take a few more lines to ensure that you can interrupt the main process, or terminate it early, cleanly, but in most cases, only a few more.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Do I need threading for my GUI?
by jdavidboyd (Friar) on Feb 19, 2008 at 19:00 UTC
    You are going to show us how you do this, right? Please? A small sample program? Dave

      Sure:

      Existing script:

      ... use threads; ## Additional line 1 ... async{ ## Additional line 2 ## existing, long running, cpu intensive code here }; ## Additional line 3 ...

      Now the gui will be responsive, whilst the long running code runs full speed without changes.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
Re^2: Do I need threading for my GUI?
by Anonymous Monk on Feb 18, 2008 at 16:02 UTC
    My what big muscles you have :D
        BrowserUk looks great in a speedo!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2022-07-02 18:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (103 votes). Check out past polls.

    Notices?