> From: Joseph Quigley > What is the secret to have the user press the "Q" key, and the program > exits without pressing the "Enter" key? > Or the "Control" and "Q" keys to exit? > For the Macintosh, would the same command/s for "Control Q" keys be the > same as the "Apple Q" key? >
I see that Diane has suggested (what I believe to be) a pyGame solution. I had asked this question before and Danny Yoo wrote up a script that is posted at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892 With the modifications that I added (just before sending this) the code there has the ability to get the getch() behavior (not having to press enter) on the Mac (whether you are running under the pythonIDE or the Terminal), Windows, or Unix. An example of usage (assuming that the code is stored in a file named getch.py) might be, ### import getch inkey = getch._Getch() print 'Press any key to end' while inkey()=='': pass print 'ok' ### _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor