Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

print hello world at intervals 1

Status
Not open for further replies.

adekunleadekoya

Programmer
May 19, 2008
30
i need a sample tcl code that prints hello world every 5 seconds
 
I wrote the folowing code
/*******************
proc shout {} {
puts "hello";
after 60000 [shout];
}

shout
********************/

But the program prints hello world continuously without any time interval.

What i want is to print d hello world every 1 minute.

Though this will be applied in a more sohisticated context.

But the basics is enough to bootstrap me. I am a newbie to tcl/tk. Expect more of basic questions.

Feherke thanks for your helps. I will soon by like you on tcl/tk expertise.

Thanks
 
Hi

First, do not execute the shout, just name it.
Second, you must keep the application alive without blocking the thread. You can achieve this by using threads. ( Search for "thread" in the Tcl/Tk wiki. ) The simplest way is to run the example using [tt]wish[/tt].
Code:
proc shout {} {                                                                 
  puts "hello"                                                                  
  after 60000 shout                                                              
}                                                                               
                                                                                
shout

Feherke.
 
it works excellently thanks feherke .

i will b bak wit more basics
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top