Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #106979

Re: Convert input to upper case on screen as it is typed

From Ben Finney <ben+python@benfinney.id.au>
Newsgroups comp.lang.python
Subject Re: Convert input to upper case on screen as it is typed
Date 2016-04-14 17:53 +1000
Message-ID <mailman.96.1460620413.15650.python-list@python.org> (permalink)
References <85oa9cyiqt.fsf@benfinney.id.au> <mailman.90.1460604334.15650.python-list@python.org> <nen5jj$hvi$1@dont-email.me> <85bn5cy6bz.fsf@benfinney.id.au>

Show all headers | View raw


Dan Sommers <dan@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@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Convert input to upper case on screen as it is typed Ben Finney <ben+python@benfinney.id.au> - 2016-04-14 13:25 +1000
  Re: Convert input to upper case on screen as it is typed Dan Sommers <dan@tombstonezero.net> - 2016-04-14 04:16 +0000
    Re: Convert input to upper case on screen as it is typed Ben Finney <ben+python@benfinney.id.au> - 2016-04-14 15:17 +1000
      Re: Convert input to upper case on screen as it is typed Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-04-14 18:35 +1200
    Re: Convert input to upper case on screen as it is typed Ben Finney <ben+python@benfinney.id.au> - 2016-04-14 17:53 +1000
      Re: Convert input to upper case on screen as it is typed Steven D'Aprano <steve@pearwood.info> - 2016-04-14 21:43 +1000
    Re: Convert input to upper case on screen as it is typed Ben Finney <ben+python@benfinney.id.au> - 2016-04-14 18:37 +1000
      Re: Convert input to upper case on screen as it is typed Marko Rauhamaa <marko@pacujo.net> - 2016-04-14 12:22 +0300
    Re: Convert input to upper case on screen as it is typed Chris Angelico <rosuav@gmail.com> - 2016-04-14 18:45 +1000
    Re: Convert input to upper case on screen as it is typed Ben Finney <ben+python@benfinney.id.au> - 2016-04-19 05:11 +1000
      Re: Convert input to upper case on screen as it is typed Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-04-19 17:46 +1200

csiph-web