By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,621 Members | 1,068 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,621 IT Pros & Developers. It's quick & easy.

keyboard "interrupt"

P: n/a
Hi Group,

I have been absent a while, mainly because I have been getting better at
figuring out my own Python problems. But not this one...

I have a timed loop performing certain tasks until a total period of
time has elapsed. I would like to be able to interrupt the loop or set
various flags during execution via keyboard input. raw_input seems to
just stop everything cold. I want the ability to just sacn the keyboard
buffer and see if something is there, then proceed normally in the loop
if there is no input in the buffer. Make sense? Totally easy? Let me
know...

wave_man
Mar 18 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a


John Fisher wrote:
Hi Group,
Hi John
I have been absent a while, mainly because I have been getting better at
figuring out my own Python problems. But not this one...

I have a timed loop performing certain tasks until a total period of
time has elapsed. I would like to be able to interrupt the loop or set
various flags during execution via keyboard input. raw_input seems to
just stop everything cold. I want the ability to just sacn the keyboard
buffer and see if something is there, then proceed normally in the loop
if there is no input in the buffer. Make sense? Totally easy? Let me
know...
If you are on a UNIX platform, you can use the curses module.

http://docs.python.org/lib/module-curses.html

There is a link there to a tutorial, but it seems to be broken. A
quick search finds it there:

http://www.amk.ca/python/howto/curses/

HTH

--
Arnaud

Mar 18 '08 #2

P: n/a
Arnaud Delobelle <ar*****@googlemail.comwrote:
John Fisher wrote:
Hi Group,

Hi John
I have been absent a while, mainly because I have been getting better at
figuring out my own Python problems. But not this one...

I have a timed loop performing certain tasks until a total period of
time has elapsed. I would like to be able to interrupt the loop or set
various flags during execution via keyboard input. raw_input seems to
just stop everything cold. I want the ability to just sacn the keyboard
buffer and see if something is there, then proceed normally in the loop
if there is no input in the buffer. Make sense? Totally easy? Let me
know...

If you are on a UNIX platform, you can use the curses module.

http://docs.python.org/lib/module-curses.html

There is a link there to a tutorial, but it seems to be broken. A
quick search finds it there:

http://www.amk.ca/python/howto/curses/

HTH

--
Arnaud
Thanks for your reply Arnaud. I am using an Intel mac, running Leopard
10.5.2, so that's Posix I warrant. I will check this out.

JF
Mar 28 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.