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

Listening for a Keypress (Console, not GUI)

P: n/a
Hello All,

I've written a small daemon that monitors a pop3 mailbox and downloads
any new messages. It's run from the console in windows, and instead of
having it print something each time it gets a message or writes a file,
i'd like to store those values as internal variables and print them to
the screen whenever the user wants to see them.

So, my question is, using a regular console, is there a way I can get
python to listen for a specific keystroke? I'm using signal handling
to deal with ^C, could I also do something like that?

TIA

Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Ok, I should really read my messages more carefully before posting, I
apologize.

This is what i'm envisioning

"Python Mail Service is running..."
<user presses S or something>

Status is printed like:

"Current Statistics"
Messages retrieved : 12345
Errors: 123
Total Files Written: 12345

Like that - again, apologies for my lack of detail in the first message

Jul 19 '05 #2

P: n/a
br****@gmail.com wrote:
So, my question is, using a regular console, is there a way I can get
python to listen for a specific keystroke? I'm using signal handling
to deal with ^C, could I also do something like that?


This might help:

http://www.python.org/doc/faq/window...thout-blocking
--
Michael Hoffman
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.