simple input that can understand special keys?

Tim G tim.golden at viacom-outdoor.co.uk
Mon Feb 28 06:09:31 EST 2005


Gabriel B. wrote:
> i'm writting an application that will use Tinker in a newer future.
> Now it's console only. I simply ommit some data on the display,
> print() some other and go on. The problem is that i can't test the
> actions tiggered by special keys, like Page Up/Down or the F1...12
>
> Right now i'm using raw_input() since even the Tk version will have
> only one input place, and for debuging i'm literally writting pageup,
> pagedow and the F's. But i want to put it in test while i write the
> GUI.
>
> is there any hope for me? I wanted to stay only with the console for
> now. And it's windows by the way :)
>
> Thanks

This is a notoriously un-cross-platform sort of issue.
Don't know about Tk, but for Windows, you could
use one of the existing console/curses packages:

Chris Gonnerman's WConIO:
http://newcenturycomputers.net/projects/wconio.html

The effbot's console module:
http://effbot.org/zone/console-index.htm

or a Win32 curses port:
http://flangy.com/dev/python/curses/

or you could splash out a bit and go for Pygame,
which gives you pretty much complete control over
pretty much everything:
http://pygame.org

or you could use the part-of-the-batteries mscvrt
module:
http://www.python.org/doc/2.4/lib/msvcrt-console.html


TJG




More information about the Python-list mailing list