Keyboard input

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Jan 29 16:38:47 EST 2010


En Fri, 29 Jan 2010 13:53:43 -0300, Mr.SpOOn <mr.spoon21 at gmail.com>  
escribió:

> I need to get keyboard input in a python program. I need it to let the
> user choose some options, for example:
>
> 1) option 1
> 2) option 2
> 3) option 3
>
> and then to input some data to the program.
>
> I'm using the raw_input method and it works fine, but I noted that I
> can't use backspace and when I accidentally press shift space (because
> I need to input uppercase letters separated by a space) it writes some
> strange characters.

That's strange. If you're using Linux, make sure you have the readline  
package installed.

> So, is there another way to get keyboard input?

If readline capabilities are not enough, you could try Urwid, a library  
for writing console programs: http://excess.org/urwid/ - but it's a big  
move. wxPython would let you write a graphical interface (and it's a  
bigger move!)

-- 
Gabriel Genellina




More information about the Python-list mailing list