For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > November 2004 > nonblocking output - in a different way









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author nonblocking output - in a different way
Alythh

2004-11-15, 3:58 pm

I know I know ... it's in the top 10 FAQs: how to output in a
nonblocking way.

My problem is just slightly different: I want to output the result of
an internal calculation (say an iteration that produces a couple of
values ($x,$y) each time) as a plot of the pixel onscreen:
$dot=$cv->createOval($x,$y,$x+1,$y+1);

from the related FAQs I saw I had to do something on the line of:
open(H, "tail -f -n 25 $ARGV[0]|") or die "Nope: $!";
$mw->fileevent(\*H, 'readable', [\&fill_text_widget, $t]);
...

but I dont know how to build my pipe: I'm not getting input from an
external program, but from an internal sub

any help appreciated...

Alessandro Magni
Ala Qumsieh

2004-11-15, 3:58 pm

Alythh wrote:
> I know I know ... it's in the top 10 FAQs: how to output in a
> nonblocking way.
>
> My problem is just slightly different: I want to output the result of
> an internal calculation (say an iteration that produces a couple of
> values ($x,$y) each time) as a plot of the pixel onscreen:
> $dot=$cv->createOval($x,$y,$x+1,$y+1);
>
> from the related FAQs I saw I had to do something on the line of:
> open(H, "tail -f -n 25 $ARGV[0]|") or die "Nope: $!";
> $mw->fileevent(\*H, 'readable', [\&fill_text_widget, $t]);
> ...


You don't seem to need fileevent. What you simply need is:

$cv->update;

after each call to createOval.

--Ala
Alythh

2004-11-16, 3:56 pm

God bless you...
that's was exactly what I needed.
Unfortunately I still have not very clear this notion of blocking
events - but in this case an "update" was just needed. Thanks!

Alessandro
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com