Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'escape': 0.04; 'python)': 0.05; 'received:verizon.net': 0.07; 'terry': 0.07; 'nicely': 0.09; 'okay': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'tty': 0.09; 'api': 0.09; 'library': 0.15; '(another': 0.16; 'cursor': 0.16; 'guis': 0.16; 'guis,': 0.16; 'msvcrt': 0.16; 'reedy': 0.16; 'scales': 0.16; 'subject:continuing': 0.16; 'versus': 0.16; 'this:': 0.16; 'wrote:': 0.16; 'linux': 0.17; 'part,': 0.18; 'jan': 0.19; '(which': 0.19; 'seems': 0.20; "haven't": 0.20; 'stuff': 0.22; 'header:In-Reply-To:1': 0.22; 'end,': 0.23; 'exist,': 0.23; 'missed': 0.24; 'pm,': 0.24; 'command': 0.24; 'input': 0.24; 'code': 0.25; 'creating': 0.25; 'remote': 0.28; 'module': 0.30; 'also.': 0.30; 'equivalent': 0.31; 'subject:?': 0.31; 'usually': 0.32; 'it.': 0.33; 'there': 0.33; 'to:addr :python-list': 0.33; 'difference': 0.34; 'done': 0.34; 'header :User-Agent:1': 0.34; 'setting': 0.34; 'surprised': 0.34; 'header:X-Complaints-To:1': 0.35; 'rather': 0.35; 'doing': 0.36; 'keyboard': 0.37; 'using': 0.37; 'but': 0.37; 'two': 0.37; 'received:org': 0.38; 'some': 0.38; 'should': 0.38; 'subject:: ': 0.39; 'header:Mime-Version:1': 0.39; 'user': 0.39; "there's": 0.39; 'to:addr:python.org': 0.39; 'case': 0.39; 'sense': 0.39; 'hit': 0.40; 'where': 0.40; 'one,': 0.40; 'your': 0.61; 'devices': 0.63; 'designed': 0.65; 'direct': 0.66; 'specialized': 0.72; 'click': 0.79; 'console,': 0.84; 'evolved': 0.84; 'joke': 0.84; 'physically': 0.84; 'contrast': 0.91; 'utilities,': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Wait for a keypress before continuing? Date: Wed, 17 Aug 2011 13:02:35 -0400 References: <4e3f2827$0$5826$c3e8da3$12bcf670@news.astraweb.com> <2670f4ee-0ab4-42ba-a472-42a4c7669ce8@p5g2000vbl.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-74-109-121-73.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20110812 Thunderbird/6.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1313600587 news.xs4all.nl 23983 [2001:888:2000:d::a6]:46183 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:11698 On 8/17/2011 12:33 PM, Seebs wrote: > On 2011-08-17, peter wrote: >> Is there an equivalent to msvcrt for Linux users? I haven't found >> one, and have resorted to some very clumsy code which turns off >> keyboard excho then reads stdin. Seems such an obvious thing to want >> to do I am surprised there is not a standard library module for it. Or >> have I missed someting (wouldn't be the first time!) > > There's no direct equivalent to the whole of msvcrt. The Unixy way to > do stuff like that on the command line is usually curses. But to make > a long story short: Unix evolved in a setting where there was often > not a user at *THE* console, and users were often on devices such that > it made sense to have all the line editing happen on the remote end, with > the remote end sending a completed line once the user was done with all > that stuff like backspaces. > > Unix programs that do stuff like this for tty input do exist, of course, > but for the most part, they use an entire API designed for creating such > utilities, rather than one or two specialized functions. (Another part > of the reason for this: The Unix solution scales nicely to the case where > the five people using your program will be doing so on physically > different hardware terminals which don't use the same escape sequences > for cursor movement.) The difference is between "Hit to continue" (which we can do in portable Python) versus "Hit any key to continue" (which we cannot, and which also leads to the joke about people searching for the 'any' key ;-). The equivalent contrast for GUIs is "Click OK to continue" versus "Click anywhere to continue" If having to click a specific area is okay for GUIs, having to hit a specific key for TUIs should be also. -- Terry Jan Reedy