Managing longer execution times in GUI 
Author Message
 Managing longer execution times in GUI

Hi,

Can I do something to be able to use my windows even if the "-command"
option of any widget or a function call takes quite some time to return.
I see that the window(s) hang till the function call returns.

This is a typical case, if you are trying to control some sort of
execution, after collecting inputs using a GUI.

Regards,
Partha



Mon, 08 Jul 2002 03:00:00 GMT  
 Managing longer execution times in GUI

Quote:

> Hi,

> Can I do something to be able to use my windows even if the "-command"
> option of any widget or a function call takes quite some time to return.
> I see that the window(s) hang till the function call returns.

> This is a typical case, if you are trying to control some sort of
> execution, after collecting inputs using a GUI.

You want something like threads, which is not possible in Perl/Tk
(yet). You can either: fork a child process in the -command handler
(if you're on unix) or call frequently (every 0.1 second or so) the
update() method. Note that you don't must use *any* Tk and X
functions, if you're using the fork method.

Regards,
        Slaven

--
use Tk;$c=tkinit->Canvas(-he,20)->grid;$x=5;map{s!\n!!g;map{create$c 'line'=>
map{$a=-43+ord;($x+($a>>3)*2=>5+($a&7)*2)}split''}split"!";$x+=12}split/_/=>'K
PI1_+09IPK_K;-OA1_+K!;A__1;Q!7G_1+QK_3CLPI90,_+K!;A_+1!KQ!.N_K+1Q!.F_1+KN.Q__1+
KN._K+1Q!.F_1+KN.Q_+1Q__+1!KQ!.N_1;Q!7G_K3,09Q_+1!K.Q_K+1Q!.F_1+KN.Q_';MainLoop



Tue, 09 Jul 2002 03:00:00 GMT  
 Managing longer execution times in GUI

Quote:


> > Can I do something to be able to use my windows even if the "-command"
> > option of any widget or a function call takes quite some time to return.
> > I see that the window(s) hang till the function call returns.

> > This is a typical case, if you are trying to control some sort of
> > execution, after collecting inputs using a GUI.

> You want something like threads, which is not possible in Perl/Tk
> (yet). You can either: fork a child process in the -command handler
> (if you're on unix) or call frequently (every 0.1 second or so) the
> update() method. Note that you don't must use *any* Tk and X
> functions, if you're using the fork method

I have not been able to use the fork() in Tk without an "exec" in the child - but
that way, I cannot run a subroutine in the fork (because "exec" runs a separate
command).

How can I use the update() method - can you please give me some info.....

Right now, I have compiled PERL with "Threads" (on Solaris 2.6), and am trying to
see if it works......

Thanks for the info.
-Partha



Wed, 10 Jul 2002 03:00:00 GMT  
 Managing longer execution times in GUI
this is not a simple and elegant but ..
on my NT I use swig (an interface generating tool used to extend perl)
to start a server thread
the server thread manages a display list - all the visual data
your TK gui should update.
the TK just samples the display list once every 100 mili also using
repeat
hope it helps



Quote:
> Hi,

> Can I do something to be able to use my windows even if the "-command"
> option of any widget or a function call takes quite some time to
return.
> I see that the window(s) hang till the function call returns.

> This is a typical case, if you are trying to control some sort of
> execution, after collecting inputs using a GUI.

> Regards,
> Partha

Sent via Deja.com http://www.deja.com/
Before you buy.


Thu, 11 Jul 2002 03:00:00 GMT  
 Managing longer execution times in GUI

Quote:

> this is not a simple and elegant but ..
> on my NT I use swig (an interface generating tool used to extend perl)
> to start a server thread
> the server thread manages a display list - all the visual data
> your TK gui should update.
> the TK just samples the display list once every 100 mili also using
> repeat
> hope it helps

I am building my GUI on Unix (Solaris 2.6). Does "swig" work on UNIX? Or can
you suggest something else on UNIX?

Thanks
-Partha



Fri, 12 Jul 2002 03:00:00 GMT  
 Managing longer execution times in GUI
swig was originated from the unix world and its a great tool for such
works
the trick is that you will have to set your server thread in unix
which means using solaris thread lib - not a difficult problem
or use fork - which will demand some form of ipc ( pipes or sockets)
i don't use unix with swig but check www.swig.org



Quote:

> > this is not a simple and elegant but ..
> > on my NT I use swig (an interface generating tool used to extend
perl)
> > to start a server thread
> > the server thread manages a display list - all the visual data
> > your TK gui should update.
> > the TK just samples the display list once every 100 mili also using
> > repeat
> > hope it helps

> I am building my GUI on Unix (Solaris 2.6). Does "swig" work on UNIX?
Or can
> you suggest something else on UNIX?

> Thanks
> -Partha

Sent via Deja.com http://www.deja.com/
Before you buy.


Sat, 13 Jul 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Managing longer execution times in GUI

2. perl5 vs perl4 execution time mystery (to me) -- LONG

3. perl script execution take a long time

4. Execution time of stripped script longer than original?

5. How to manage long regular expressions.

6. Multi-computer execution tool/controller for long processes

7. Execution of a function in exact time intervals

8. /bin/sh vs. Perl Execution Time

9. Execution time in Perl

10. Execution time question [and comments on optimizers]

11. Execution time question

12. Execution time for a script

 

 
Powered by phpBB® Forum Software