Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.049 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'cc:addr:python-list': 0.11; 'python': 0.11; '2.7': 0.14; 'cli': 0.16; 'subject:user': 0.16; 'url:html)': 0.16; 'wrote:': 0.18; 'finished': 0.19; 'entered': 0.20; 'input': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; "i've": 0.25; 'header:In-Reply-To:1': 0.27; 'characters': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'text': 0.33; 'up.': 0.33; 'url:python': 0.33; '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; 'sure': 0.39; 'how': 0.40; 'march': 0.61; 'information': 0.63; 'to:addr:gmail.com': 0.65; '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:cc:content-type; bh=QarKYWC4tfrCy58NvKPyFtzbdK3q2GUU6f3LqiB7HVs=; b=nxHeAnEiZ0Y/aJTttJDKT1qtTiE3yE1BzfqO/hmLfsNHTtHg8UEwBbHImAIWf2h7os LmqUKHtAcQdGy7in/rwjFVtSUeegIBqp2Tzy4PxQMSv2L8wm/xzn0tKOhyLiWZpL0mj+ VhfYyASkh5M8UigH7X8Y0CF1CM8Mf/IFmRCiQhKE3s/a4GxQ//ukgPNff6uMUJv8Mupg 2ftzp9tYQLZoyKOaPxcQfpIkBpPo9ZGCF1g4CHFwyN4NbtV115F0D7AjXxDrThEST6l9 vLuvM6sDxN7SIdFxSMV891sP/n87Bb9Nog0BhVG841TcdRVeGAw70Ff2qfVPaBRGaZRG fK1A== MIME-Version: 1.0 X-Received: by 10.152.111.5 with SMTP id ie5mr8435776lab.31.1364308892983; Tue, 26 Mar 2013 07:41:32 -0700 (PDT) In-Reply-To: References: Date: Tue, 26 Mar 2013 14:41:32 +0000 Subject: Re: Processing user input as it's entered From: Arnaud Delobelle To: Sven Content-Type: text/plain; charset=UTF-8 Cc: python-list 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1364308901 news.xs4all.nl 6916 [2001:888:2000:d::a6]:53716 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41908 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) -- Arnaud