Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.053 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; 'python': 0.11; 'assume': 0.14; '2.7': 0.14; 'cli': 0.16; 'subject:user': 0.16; 'wrote:': 0.18; 'finished': 0.19; 'entered': 0.20; 'input': 0.22; 'email addr:gmail.com>': 0.22; 'text.': 0.24; "i've": 0.25; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'characters': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'work.': 0.31; 'text': 0.33; 'up.': 0.33; 'url:python': 0.33; 'to:name:python-list': 0.33; 'could': 0.34; 'display': 0.35; 'tool': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'url:org': 0.36; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'march': 0.61; 'information': 0.63; 'wiring': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=SQg9Ga36fAFMP5UjDlL0tt7pXe7pC46zqVh4FfTo52A=; b=f8JtAkDntDCB25K/AdH4rBxr+CFGfORnHlWmwvwF0KlBwt9QHeJciHvReKraa1u+3Z KXmU3bVd2JJY3RMctue3NZb/QE89m/FyLREKM9Hju2r5AmuRwBOPQtm5yWN2iP7oSr3Z 5BQ0KrkMP9PRZEHCEd0RcEQf+RRn/CQKAHH56LMfKiLWEsEG3vK0yai3MEcCR6yAWbW4 lVl0uDSu1OM8UjOdH5mi0tpTVqlZ52QL4ke9nAeCpuvhP15Tt1pyV9rExy/pfibJMP9m JGF4gAUWO8hw6IfveeubgRNgbe4F1QgRgPflA5bhIBSZzAtDsX3DwzOK8qnRv/0cieI8 r1Lg== MIME-Version: 1.0 X-Received: by 10.180.187.129 with SMTP id fs1mr3986050wic.5.1364311199158; Tue, 26 Mar 2013 08:19:59 -0700 (PDT) In-Reply-To: References: Date: Tue, 26 Mar 2013 15:19:59 +0000 Subject: Re: Processing user input as it's entered From: Sven To: python-list Content-Type: multipart/alternative; boundary=001a11c267226396a704d8d574d8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 73 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1364311206 news.xs4all.nl 6904 [2001:888:2000:d::a6]:44937 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41912 --001a11c267226396a704d8d574d8 Content-Type: text/plain; charset=ISO-8859-1 On 26 March 2013 14:41, Arnaud Delobelle wrote: > On 26 March 2013 10:07, Sven wrote: > > Hello, > > > > Is there a way (ideally cross platform but a *nix OS solution would be > > great) to process user input as they type? > > What I aim to achieve is to count the number of characters a user has > > entered and display it while they are typing. The entered text will also > > need to be captured once the user has finished typing. > > > > This is a gui-less CLI tool for python 2.7 > > > > I've seen some information on tty.setraw but I'm not sure how you'd go > about > > wiring that up. > > Can you use curses (http://docs.python.org/2/library/curses.html This could work. I've not used it before so I am having some issues echoing out the text. I assume I can use this without having to create an ncurses UI? -- ./Sven --001a11c267226396a704d8d574d8 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

= On 26 March 2013 14:41, Arnaud Delobelle <arnodel@gmail.com>= wrote:
On 26 March 2013 10:07, = Sven <svenito@gmail.com> wro= te:
> Hello,
>
> Is there a way (ideally cross platform but a *nix OS solution would be=
> great) to process user input as they type?
> What I aim to achieve is to count the number of characters a user has<= br> > entered and display it while they are typing. The entered text will al= so
> need to be captured once the user has finished typing.
>
> This is a gui-less CLI tool for python 2.7
>
> I've seen some information on tty.setraw but I'm not sure how = you'd go about
> wiring that up.

Can you use curses (http://docs.python.org/2/library/curses.htm= l

=A0

This could w= ork. I've not used it before so I am having some issues echoing out the= text. I assume I can use this without having to create an ncurses UI?

--
./Sven
--001a11c267226396a704d8d574d8--