Re: stdin: processing characters

2006-05-01 Thread Russ Salsbury
Serge Orlov wrote: > Kevin Simmons wrote: > > Looks reasonable if you don't need portability. But you may want to > refactor it a little bit to make sure terminal setting are always > restored: > > try: > do_all_the_work() > finally: > os.system("stty cooked") > IIRC You need to do "stty

Re: stdin: processing characters

2006-05-01 Thread Serge Orlov
Kevin Simmons wrote: > Thanks for your input. I found an answer that suits my needs, not curses > :-), but stty settings and sys.stdin.read(n) : > > import os, sys > > while 1: > os.system("stty -icanon min 1 time 0") > print """ > Radio computer control program. > -

Re: stdin: processing characters

2006-05-01 Thread Kevin Simmons
Serge Orlov wrote: > Cameron Laird wrote: >> In article <[EMAIL PROTECTED]>, >> Edward Elliott <[EMAIL PROTECTED]> wrote: >>> Kevin Simmons wrote: I have a python script that prompts the user for input from stdin via a menu. I want to process that input when the user types in two charact

Re: stdin: processing characters

2006-04-30 Thread Serge Orlov
Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Edward Elliott <[EMAIL PROTECTED]> wrote: > >Kevin Simmons wrote: > >> I have a python script that prompts the user for input from stdin via a > >> menu. I want to process that input when the user types in two characters > >> and not have t

Re: stdin: processing characters

2006-04-30 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Edward Elliott <[EMAIL PROTECTED]> wrote: >Kevin Simmons wrote: >> I have a python script that prompts the user for input from stdin via a >> menu. I want to process that input when the user types in two characters >> and not have to have the user press . As a compa

Re: stdin: processing characters

2006-04-27 Thread Edward Elliott
Kevin Simmons wrote: > I have a python script that prompts the user for input from stdin via a > menu. I want to process that input when the user types in two characters > and not have to have the user press . As a comparison, in the bash > shell one can use (read -n 2 -p "-->" CHOICE; case $CHOICE

stdin: processing characters

2006-04-27 Thread Kevin Simmons
I have seen this question asked a few times but have not seen a clear answer... I have a python script that prompts the user for input from stdin via a menu. I want to process that input when the user types in two characters and not have to have the user press . As a comparison, in the bash shell