[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Getting input from command line



Fiona Burrows wrote:


Michael wrote:
On Monday 01 December 2008 12:57:15 Fiona Burrows wrote:
I know this isn't directly related to PyGame but I figured there were
worse places to ask a question like this

This page is your friend:

http://openbookproject.net/py4fun/lode/lode.html#auto2

In fact the entire site is quite fun...

   http://openbookproject.net/py4fun/

... but with a name like that it would be.

Specifically this file shows you what you need to do:
http://openbookproject.net//py4fun/lode/ttyLinux.py

Specifically you have to change the console mode to spit out characters at
a time, you can then play with them and when your program exits change it
back again.


Michael.
That looks extremely useful, thank you! Unfortunately it's Unix-like only. (At least that's what the Python docs say about termios.) Is there a Windows alternative that you know of? I could just check what the OS is and use the specific routines for the platform.

Thanks!
Fiona
--
*Sputnik Internet **¤
* Web & Graphic Design, Marketing & Illustration
30 King Street
Manchester
M2 6AZ

Tel 0870 742 5959
E-mail: fiona@xxxxxxxxxxxxxxxxxxx <mailto:fiona@xxxxxxxxxxxxxxxxxxx>
Web: http://www.sputnikinternet.com <http://www.sputnikinternet.com/>
**

The msvcrt module has Windows console I/O routines, including kbhit() (Section 36.2.2 in the Python 2.5 docs). I don't know of any platform independent console routines in Python.

--
Lenard Lindstrom
<len-l@xxxxxxxxx>