Hey all,

I'm having a problem with using msvcrt.getch() .  What I want is some 
functionality like this:

print 'blah blah blah, good_input to do blah blah blah, exit_key to exit'

while input != exit_key:
    input = get_input_from_getch()

    if input == good_input:
        print input
        #do something
    if input == bad_input:
        #ask for new input
    if input == exit_key:
        pass

so, if the user's input is good, the input is printed to the screen and the 
user is allowed to put in more input.
if the user's input is bad, the input is not printed to the screen and python 
ignores the input.
if the user presses a designated key then the program continues.

for some reason, all I get when I try to implement getch() is python getting 
stuck in an infinite loop and printing "ΓΏ" continuously.  I tried using 
msvcrt.kbhit() to wait for a key to be pressed before continuing to getch() but 
it seems the program then skips the loop entirely.

I guess I just don't really understand how to use getch(). =(
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to