Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
G'day simonz, Welcome to the monastery. That's actually a rather vague question; however, the mechanism you're probably looking for is the callback (see Tk::callbacks). A Tk application is event-driven. You don't write code that waits for some event to occur (or complete), you associate a callback with the event which is called when that event occurs (or completes). Here's some examples:
If the processing involved with a callback takes an inordinate amount of time to complete, then you may need a separate process so that the Tk process doesn't block. That could involve threads or forking a child process (see perlipc). Here's a fairly straightforward way of forking a long running process, using open and Tk::fileevent, that won't block while waiting for the child process to return output:
As I said at the start, your question is rather vague. The information I've provided here should be sufficient for dealing with the usual culprits. If you're having difficulty with a particular problem that I haven't addressed, post specific information and we can look at it. If you do need to post a follow-up question, please follow the guidelines in "How do I post a question effectively?": a better question gets better answers. -- Ken In reply to Re: perl tk mainwindow hangs
by kcott
|
|