Convert input to upper case on screen as it is typed
Ben Finney
ben+python at benfinney.id.au
Thu Apr 14 03:53:20 EDT 2016
Dan Sommers <dan at tombstonezero.net> writes:
> I don't know which OS you're using, but if I run "stty olcuc" in my
> Linux shell, then the input driver does that for me.
Gregory Ewing <greg.ewing at canterbury.ac.nz> writes:
> You might be able to do something with the termios module
> to put the tty driver into the appropriate mode.
>
> If you do that, you'll have to be careful to set it back
> again before the program exits for any reason, otherwise
> your shell session will be messed up.
Thank you both.
Okay, ‘termios.tcgetattr’ will let me preserve the attributes, and with
Dan Sommers's suggestion of which attribute to use, I may have a shot at
setting the terminal attributes.
Then with a top-level exception handler I can clean up by restoring the
saved attributes with ‘termios.tcsetattr’.
I will investigate along those lines.
--
\ “Some people have a problem, and they think “I know, I'll use |
`\ Perl!”. Now they have some number of problems but they're not |
_o__) sure whether it's a string or an integer.” —Benno Rice, 2011 |
Ben Finney
More information about the Python-list
mailing list