

Determine if a key has been pressed and store this in a variable.

If no key has been pressed, the program should continue without waiting.




fconfigure stdin -blocking 0
set ch [read stdin 1]
fconfigure stdin -blocking 1
 
if {$ch eq ""} {
    # Nothing was read
} else {
    # Got the character $ch
}