[Tutor] Comma at the end of a print command

Alan Gauld alan.gauld at blueyonder.co.uk
Wed Aug 18 09:55:16 CEST 2004


> >     model = msvcrt.getch()
> >     if model == '1':
> >         print model(*)
> >         model = msvcrt.getch() ##to get the next number
>
> This is most likely to bring back another 1 or a null character
> because the time between detecting the 1 and reading getch again
> is going to be tiny. You will need to loop to detect the user input.
> Using getch() is much more complex than using raw_input.
>
> I've found that using msvcrt.getch() again merely forces the program
to wait
> until the next button pushed and processing it.

I finally got around to playing with getch()

You are absolutely right. I'm sure it didn't used to do that but
maybe my memory is playing tricks on me. It certainly makes
getch() much easier to use!

On a related note the curses library seems to have had a major
overhaul and (to an old curses programmer like me) is now really
complex with methods and objects scattered all over various
modules. Using getch() under curses has now become much more
difficult. I will need to rewrite my event-handling tutor
topic to reflect this - bummer!! When did this happen?
And where have the handy wXXX methods all gone?

:-(

Alan G.



More information about the Tutor mailing list