Newbie question on creating a delay event 
Author Message
 Newbie question on creating a delay event

Hello,
I hope this makes sense.  I have a main window, and I want to be able to
update the text in a label on this main window periodically, say every
20 seconds.  TO do this I would like to be able to call a subroutine,
called something like update.  I am not sure really how I could do this:

My code looks a little something like this:

 my $main = new MainWindow;

 my $result1 = $main->Label(-text => $result)->pack;

MainLoop;

sub do_message {
   $result1->configure(-text => "$update_value");

Quote:
}

I want to be able to call do_message every 20 seconds.

Cheers,
Scott



Fri, 17 Oct 2003 18:09:16 GMT  
 Newbie question on creating a delay event

Quote:

>Hello,
>I hope this makes sense.  I have a main window, and I want to be able to
>update the text in a label on this main window periodically, say every
>20 seconds.  TO do this I would like to be able to call a subroutine,
>called something like update.  I am not sure really how I could do this:

>My code looks a little something like this:

> my $main = new MainWindow;

> my $result1 = $main->Label(-text => $result)->pack;

#add this..
$main->repeat(20000,\&do_message);
# You might also consider using -textvariable for the label.
Quote:

>MainLoop;

>sub do_message {
>   $result1->configure(-text => "$update_value");

# or if you are using a -textvariable then no configure is needed.
$mytextvariable = $update_value;

Quote:
>}

>I want to be able to call do_message every 20 seconds.

>Cheers,
>Scott

use Tk;$/=$]<<$]+1;$"=tkinit->Canvas(-wi,$/,-he,$/)->form;map{map{create$"('t',
rand$/,rand$/,-te,chr(hex($]<<1+1)+ord))}split''}'*05%324,!(.!/#4+(%%22';while
($]){update$";map{($I,$l)=coords$"($_);$I<$_*$/>>$]?$;=1:($;=-1);$_%(1<<1)?($l
<$/>>1+1?$\=1:($\=-1)):($l<$/>>1?$\=1:($\=-1));move$"($_,$;,$\)}find$"('all')}


Fri, 17 Oct 2003 18:57:04 GMT  
 Newbie question on creating a delay event
Cheers
Quote:


> >Hello,
> >I hope this makes sense.  I have a main window, and I want to be able to
> >update the text in a label on this main window periodically, say every
> >20 seconds.  TO do this I would like to be able to call a subroutine,
> >called something like update.  I am not sure really how I could do this:

> >My code looks a little something like this:

> > my $main = new MainWindow;

> > my $result1 = $main->Label(-text => $result)->pack;

> #add this..
> $main->repeat(20000,\&do_message);
> # You might also consider using -textvariable for the label.

> >MainLoop;

> >sub do_message {
> >   $result1->configure(-text => "$update_value");
> # or if you are using a -textvariable then no configure is needed.
> $mytextvariable = $update_value;
> >}

> >I want to be able to call do_message every 20 seconds.

> >Cheers,
> >Scott

> use Tk;$/=$]<<$]+1;$"=tkinit->Canvas(-wi,$/,-he,$/)->form;map{map{create$"('t',
> rand$/,rand$/,-te,chr(hex($]<<1+1)+ord))}split''}'*05%324,!(.!/#4+(%%22';while
> ($]){update$";map{($I,$l)=coords$"($_);$I<$_*$/>>$]?$;=1:($;=-1);$_%(1<<1)?($l
> <$/>>1+1?$\=1:($\=-1)):($l<$/>>1?$\=1:($\=-1));move$"($_,$;,$\)}find$"('all')}



Fri, 17 Oct 2003 21:19:38 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Newbie question: recurse all folders and create md5 digest for each file

2. Newbie question (Creating Perl module with SWIG)

3. Newbie question: Creating a NT login script in Perl

4. Newbie question: Creating L/Ps in a DBM

5. newbie trying to create library - questions

6. Win32::EventLog - creating events

7. How to create new Events?

8. Delayed variable interpolation in string question

9. Pigheadedness (was Re: Newbie; Perl/Tk Event models)

10. Newbie: Mouse events

11. Events - newbie

12. Events .. (newbie)

 

 
Powered by phpBB® Forum Software