capturing arrow keys and tab
Robin Munn
rmunn at pobox.com
Sat Mar 29 18:47:58 EST 2003
Joe Connellan <joe at rsp.com.au> wrote:
> I'm trying to capture the arrow and tab keys when doing a simple
> interactive console application. I've looked at the
> code.interativeConsole code but couldn't find where it's capturing the
> arrow keys (for browsing through the history), eg pressing the up key
> will look at the previously entered command (in linux) instead of typing
> "^[[A"
>
> Does anyone know how to do this?
If you're trying to replicate the behavior of having the up arrow browse
through a command history, that is supplied by the GNU readline library.
Googling for "Python readline" may help.
If you want to use the arrow keys for something else, like text-based
menus, you may want to look at the curses module.
Either way, what you are trying to do has probably been done before, so
save yourself some work and profit from other people's generosity! :-)
--
Robin Munn <rmunn at pobox.com>
http://www.rmunn.com/
PGP key ID: 0x6AFB6838 50FF 2478 CFFB 081A 8338 54F7 845D ACFD 6AFB 6838
More information about the Python-list
mailing list