capturing ESC, page up/down in Python
Tim Roberts
timr at probo.com
Sun Oct 26 20:49:57 EDT 2008
jordilin <jordilin at gmail.com> wrote:
>
>Is there any way to capture the keyboard events ESC, page up (next
>page), page down (previous page) in Python?. I mean, how can I capture
>if user presses one of those keys in a terminal based application? I
>was thinking about pygame.key.get_pressed from the pygame module, but
>I don't feel really happy about importing pygame in a non related game
>project.
Are you talking about Windows or Unix? It matters.
In Windows, if you don't need a bunch of other features, you should check
out the WConio package. It has kbhit and getch functions that can do this.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-list
mailing list