Re: Wait for a keypress before continuing?

2011-08-21 Thread Tim Roberts
John Doe wrote: > >Tim Roberts wrote: > >> That exact code works perfectly for me. The function returns as >> soon as I press the escape key. You are running this from a >> console process, and not a GUI process, right? > >No. I am running this from within Windows, all sorts of Windows. > >S

Re: Wait for a keypress before continuing?

2011-08-18 Thread Nobody
On Thu, 18 Aug 2011 01:24:30 -0700, peter wrote: > This is very similar to my solution, which was to use stty turn off > keyboard echo, then repeatedly read sys.stdin.read(1) until a unique > keystroke had been defined. For example, the 'Insert' key seems to > return a sequence of four codes, name

Re: Wait for a keypress before continuing?

2011-08-18 Thread peter
On Aug 17, 3:16 pm, Hans Mulder wrote: > On 17/08/11 10:03:00, 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 d

Re: Wait for a keypress before continuing?

2011-08-17 Thread Chris Angelico
On Wed, Aug 17, 2011 at 7:29 PM, Steven D'Aprano wrote: > The raw_input/input UI is well-designed for entering plain text data. It is > extremely poor as a command interface. > > ... (Imagine how awkward it would be to use a TUI mail client or > text editor where the only user input was from somet

Re: Wait for a keypress before continuing?

2011-08-17 Thread Steven D'Aprano
Terry Reedy wrote: > 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"

Re: Wait for a keypress before continuing?

2011-08-17 Thread Ethan Furman
Seebs wrote: Pathological narcissism is scary. If you ever find yourself going longer than usual without being wrong, start checking your work more carefully. :) +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

Re: Wait for a keypress before continuing?

2011-08-17 Thread Seebs
On 2011-08-17, Terry Reedy wrote: > 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 > ;-). And more importantly, frustration and co

Re: Wait for a keypress before continuing?

2011-08-17 Thread Seebs
On 2011-08-17, Steven D'Aprano wrote: > I shouldn't need to say this to anyone over the age of four, but being > obnoxious to people trying to help does not encourage others to answer your > question. You don't win points for insulting people who are trying to solve > your problems. The frustrati

Re: Wait for a keypress before continuing?

2011-08-17 Thread Terry Reedy
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 n

Re: Wait for a keypress before continuing?

2011-08-17 Thread Seebs
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 fo

Re: Wait for a keypress before continuing?

2011-08-17 Thread Steven D'Aprano
Hans Mulder wrote: > Strictly speaking, os.system is deprecated and you should use > the equivalent invocation of subprocess.call: Strictly speaking, os.system is *not* deprecated in either Python 2.x or 3.x. Latest stable documentation for Python 2.7 and 3.2: http://docs.python.org/library/os.h

Re: Wait for a keypress before continuing?

2011-08-17 Thread Hans Mulder
On 17/08/11 10:03:00, 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 fo

Re: Wait for a keypress before continuing?

2011-08-17 Thread Ethan Furman
Welcome to my killfile. *plonk* -- http://mail.python.org/mailman/listinfo/python-list

Re: Wait for a keypress before continuing?

2011-08-17 Thread Steven D'Aprano
On Wed, 17 Aug 2011 05:23 pm John Doe wrote: > You have every right to an opinion, Fuckturd. I shouldn't need to say this to anyone over the age of four, but being obnoxious to people trying to help does not encourage others to answer your question. You don't win points for insulting people who

Re: Wait for a keypress before continuing?

2011-08-17 Thread peter
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 (woul

Re: Wait for a keypress before continuing?

2011-08-17 Thread John Doe
cientology) <-- get educated! > I am not speaking for my employer, although they do rent some of my opinions. > > > Path: > news.astraweb.com!border6.newsrouter.astraweb.com!news.glorb.com!newsfeeds.sol.net!post2.nntp.sol.net!posts.news.megabitz.net!nnrp3-asbnva.megabitz.net!

Re: Wait for a keypress before continuing?

2011-08-17 Thread Chris Angelico
On Wed, Aug 17, 2011 at 7:12 AM, Seebs wrote: >> Yes, even the common term "command line" is foreign to me. I do >> some powerful stuff in Windows, without need for a command line. > > So apparently you *do* know the term.  Normally, to say that a term is > foreign to you is to say that you have n

Re: Wait for a keypress before continuing?

2011-08-16 Thread Seebs
On 2011-08-17, John Doe wrote: > Context is lost when you quote only one level. Not significantly. > I was not answering a question about my code. I was pointing out > the fact that my questioner's terminology is strange/corrupt. Well, that's the thing. There was a question there, with perf

Re: Wait for a keypress before continuing?

2011-08-16 Thread John Doe
gt; news.astraweb.com!border6.newsrouter.astraweb.com!news.glorb.com!news-out.readnews.com!transit3.readnews.com!newspump.sol.net!post2.nntp.sol.net!posts.news.megabitz.net!nnrp2-asbnva.megabitz.net!not-for-mail > Newsgroups: comp.lang.python > From: Seebs > Subject: Re: Wait for a keypress befor

Re: Wait for a keypress before continuing?

2011-08-16 Thread Seebs
On 2011-08-17, John Doe wrote: > Using "does your code have a GUI" produces zero search results. > Maybe that works better in some other language. You shouldn't need a search engine to answer a question about your code. If you do, it suggests that perhaps one or more of the terms are unfamiliar

Re: Wait for a keypress before continuing?

2011-08-16 Thread John Doe
.com; s=gamma; > h=mime-version:in-reply-to:references:date:message-id:subject:from:to > :content-type; bh=09nEr3tlARCpTiOfhP1XOnteJhDd/baJpJhzNhp5UsI=; > b=v9cmI/PvRfaLZhXxYs1bHlUOG+IaGEjPq0Xmx+WTkTOPc5YRFRNivsVO8wgKHaWXZm > LhxtRbBJaAJuZlXNZ2rX2BxXaT8VJ6wnn2Z1gRv83Jqxi+jJ4zHcfExLPrL

Re: Wait for a keypress before continuing?

2011-08-16 Thread Jerry Hill
On Tue, Aug 16, 2011 at 5:59 PM, John Doe wrote: > No. I am running this from within Windows, all sorts of Windows. What does that mean? You seem very resistant to answering anyone's questions about your code. Is your code run from the command line, or does it have a GUI? If it has a GUI, what

Re: Wait for a keypress before continuing?

2011-08-16 Thread John Doe
Okay... Looks like I need pyHook. -- http://mail.python.org/mailman/listinfo/python-list

Re: Wait for a keypress before continuing?

2011-08-16 Thread John Doe
Tim Roberts wrote: > John Doe wrote: > >>def wait_for_keystroke(): >> char=0 while not (char==chr(27) or char==chr(110)): >>char=msvcrt.getch() if char==0: >> return >> >>That freezes the process. > > That exact code works perfectly for me. The function returns as > soon as I

Re: Wait for a keypress before continuing?

2011-08-16 Thread Tim Roberts
John Doe wrote: >def wait_for_keystroke(): > char=0 > while not (char==chr(27) or char==chr(110)): >char=msvcrt.getch() >if char==0: > return > >That freezes the process. That exact code works perfectly for me. The function returns as soon as I press the escape key. You are runn

Re: Wait for a keypress before continuing?

2011-08-16 Thread John Doe
def wait_for_keystroke(): char=0 while not (char==chr(27) or char==chr(110)): char=msvcrt.getch() if char==0: return That freezes the process. That means char=msvcrt.getch() is getting something? Could it have something to do with the formatting of the character? -- http://mail.

Re: Wait for a keypress before continuing?

2011-08-16 Thread John Doe
> def wait_for_keystroke(): > char=0 > while not char==0x1B: > char=msvcrt.getch() I tried using while not char==chr(27): -- http://mail.python.org/mailman/listinfo/python-list

Re: Wait for a keypress before continuing?

2011-08-16 Thread John Doe
def wait_for_keystroke(): char=0 while not char==0x1B: char=msvcrt.getch() That freezes the process. Am I using the right code for the escape key, or doing anything else wrong? Again, I know it could be my system. But I must find a way to do this from within Windows. I use a keyboard ho

Re: Wait for a keypress before continuing?

2011-08-08 Thread Gelonida N
On 08/08/2011 04:44 AM, John Doe wrote: > Steven D'Aprano wrote: > >> Also, are you using an IDE? If so, it could very well be >> interfering with the keyboard buffer > > I really don't know how to answer your question. I am using > Windows XP SP3. Komodo Edit 6 for editing the *.py file. Dr

Re: Wait for a keypress before continuing?

2011-08-07 Thread John Doe
Steven D'Aprano wrote: > Also, are you using an IDE? If so, it could very well be > interfering with the keyboard buffer I really don't know how to answer your question. I am using Windows XP SP3. Komodo Edit 6 for editing the *.py file. Dragon Naturally Speaking, Natlink, and Dragonfly mig

Re: Wait for a keypress before continuing?

2011-08-07 Thread Steven D'Aprano
John Doe wrote: > My program does not need a prompt, it just needs to wait for any > key to be pressed before it continues. This is in Windows. > > char=0 > while not char: > char=msvcrt.getch() > > That doesn't delay anything here. Works perfectly for me. You don't need the while loop,

Wait for a keypress before continuing?

2011-08-07 Thread John Doe
My program does not need a prompt, it just needs to wait for any key to be pressed before it continues. This is in Windows. char=0 while not char: char=msvcrt.getch() That doesn't delay anything here. while 1: char=msvcrt.getch() break That appears to put my program into an