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
In reply to Re: How can I get raw keydown and keyup events from a keyboard device?
by hossman
in thread How can I get raw keydown and keyup events from a keyboard device?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |