[plt-scheme] Scan key code in non-gui mode

From: Jakub Piotr Cłapa (jpc-ml at zenburn.net)
Date: Sun Feb 7 06:07:51 EST 2010

On 06-02-10 17:17, Thomas Chust wrote:
> If you want to do this in a terminal on a POSIX compliant system, I
> would suggest using the external stty program to set an appropriate
> input/output mode before simply reading characters or bytes from the
> terminal device using standard Scheme procedures. An example program is
> attached to this message -- save the two modules in the same directory
> and run mzscheme -t- keys.ss in a terminal to try it out.

You could also use ncurses but it may be an overkill for such a simple 
thing.

> In a Windows terminal window you would have to use some native C API to
> achieve the same effect.

I attached a simple Python module that does this and a little more 
(mainly changing window size and text/background colors). It is based on 
pywin32 which closely follows the C Win32 API. It should be easy to port 
the code to Scheme FFI with a little help from MSDN.

-- 
regards,
Jakub Piotr Cłapa
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: WConio.py
URL: <http://lists.racket-lang.org/users/archive/attachments/20100207/abc9d75c/attachment.ksh>

Posted on the users mailing list.