Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old March 18th, 2008, 10:25 PM
John Fisher
Guest
 
Posts: n/a
Default keyboard "interrupt"

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
  #2  
Old March 18th, 2008, 10:45 PM
Arnaud Delobelle
Guest
 
Posts: n/a
Default Re: keyboard "interrupt"



John Fisher wrote:
Quote:
Hi Group,
Hi John
Quote:
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

  #3  
Old March 28th, 2008, 01:09 AM
John Fisher
Guest
 
Posts: n/a
Default Re: keyboard "interrupt"

Arnaud Delobelle <arnodel@googlemail.comwrote:
Quote:
John Fisher wrote:
Quote:
Hi Group,
>
Hi John
>
Quote:
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
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles