Re: Wait for a keypress before continuing?

2011-08-21 Thread Tim Roberts
John Doe jdoe@usenetlove.invalid wrote: Tim Roberts timr probo.com 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,

Re: Wait for a keypress before continuing?

2011-08-18 Thread peter
On Aug 17, 3:16 pm, Hans Mulder han...@xs4all.nl 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

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, namely

Re: Wait for a keypress before continuing?

2011-08-17 Thread Seebs
On 2011-08-17, John Doe jdoe@usenetlove.invalid 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

Re: Wait for a keypress before continuing?

2011-08-17 Thread Chris Angelico
On Wed, Aug 17, 2011 at 7:12 AM, Seebs usenet-nos...@seebs.net 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

Re: Wait for a keypress before continuing?

2011-08-17 Thread John Doe
!not-for-mail Newsgroups: comp.lang.python From: Seebs usenet-nospam seebs.net Subject: Re: Wait for a keypress before continuing? References: 4e3f2827$0$5826$c3e8da3$12bcf670 news.astraweb.com 4e4ad039$0$9663$c3e8da3$76491128 news.astraweb.com acpl475c1ae1pgcv73hj2oqln7n0qn6tkl 4ax.com 4e4ae844$0

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

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 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 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

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:

Re: Wait for a keypress before continuing?

2011-08-17 Thread Seebs
On 2011-08-17, peter peter.mos...@talk21.com 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

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, peterpeter.mos...@talk21.com 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

Re: Wait for a keypress before continuing?

2011-08-17 Thread Seebs
On 2011-08-17, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info 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

Re: Wait for a keypress before continuing?

2011-08-17 Thread Seebs
On 2011-08-17, Terry Reedy tjre...@udel.edu wrote: The difference is between Hit enter 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,

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 Steven D'Aprano
Terry Reedy wrote: The difference is between Hit enter 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 Chris Angelico
On Wed, Aug 17, 2011 at 7:29 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info 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

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

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==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? --

Re: Wait for a keypress before continuing?

2011-08-16 Thread Tim Roberts
John Doe jdoe@usenetlove.invalid 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

Re: Wait for a keypress before continuing?

2011-08-16 Thread John Doe
Tim Roberts timr probo.com wrote: John Doe jdoe@usenetlove.invalid 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

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 Jerry Hill
On Tue, Aug 16, 2011 at 5:59 PM, John Doe jdoe@usenetlove.invalid 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?

Re: Wait for a keypress before continuing?

2011-08-16 Thread John Doe
$c3e8da3$92d0a893 news.astraweb.com Date: Tue, 16 Aug 2011 20:11:39 -0400 Subject: Re: Wait for a keypress before continuing? From: Jerry Hill malaclypse2 gmail.com To: python-list python.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list python.org X-Mailman-Version: 2.1.12

Re: Wait for a keypress before continuing?

2011-08-16 Thread Seebs
On 2011-08-17, John Doe jdoe@usenetlove.invalid 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

Re: Wait for a keypress before continuing?

2011-08-16 Thread John Doe
!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 usenet-nospam seebs.net Subject: Re: Wait for a keypress before continuing? References: 4e3f2827$0$5826$c3e8da3$12bcf670

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 steve+comp.lang.python pearwood.info 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

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, since

Re: Wait for a keypress before continuing?

2011-08-07 Thread John Doe
Steven D'Aprano steve+comp.lang.python pearwood.info 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