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!

Help needed!!!

Status
Not open for further replies.

sergelaurent

Technical User
May 30, 2005
52
FR
Does anyone out knows how to program an interruption task in tcl/tk?

In fact, I have the following code:
while {$toto==1}
incr i
}

I want to stop the loop by a simple touch on the keyboard. Is this possile?

How can I do this?

Thanks
lolo
 
First of all, I think you need to use the Wish (Tk) shell. I don't think Tclsh processes "events".

The event you want is KeyPress so you might try something like this:
set a 1
bind . <KeyPress> {set a 0}
set i 0
while {$toto==1 && $a} {
incr i
update;#[red]you need to update to process loop events[/red]
}


_________________
Bob Rashkin
rrashkin@csc.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top