I'm fairly certain you can't do this through any shell, those are character stream based -- not event based.
As some people pointed out, Tk (or Gtk, or just about any Windowing system) can do this, becuase X (And it's alternate OS counterparts) are event driven.
This is from the Gtk-Perl Tutorial (I assume Tk is very similar)...
GTK is an event driven toolkit, which means it will sleep in main Gtk until an event occurs and control is passed to the appropriate function.
This passing of control is done using the idea of "signals". These signals are not the same as the Unix system signals, and are not implemented using
them, although the terminology is almost identical. When something like the press of a mouse button occurs, the appropriate signal will be "emitted" by
the widget that was pressed. This is how GTK does most of its useful work. There are signals that all widgets inherit, such as 'destroy', and there
are signals that are widget specific, such as the 'toggled' signal on a toggle button.
...
In adddition to the signal mechanism described above, there is a set of events that reflect the X event mechanism. Callback may also be attached to
these events. These events are:
...
- key_press_event
- key_release_event
| [reply] |
Tk does this. You can independantly catch the key up and key down events.
| [reply] |