473,411 Members | 2,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Listening for a Keypress (Console, not GUI)

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
2 3051
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: MumboJumbo | last post by:
Hi I have a really basic question hopefully some can help me with: Can you write a (i.e. one) C# project that works from the cmd line and gui? I seems if i write a GUI app it can't write to...
1
by: Rene | last post by:
Hi, I am running is some problems with the KeyPreview and KeyPress events. The KeyPress event is only triggered when there this an focusable control on the form. When all controls are disabled...
6
by: metiu | last post by:
Say I have a console app that does something in three steps: - opens a file - transfers the file through a serial port - does some elaborations and I want to build a GUI around it that, for...
4
by: eduardorp1 | last post by:
I have a GUI application that needs to be invoked from the command line as well. It should work both as a GUI and as a console application. When I invoke it from the command line, it reads all...
2
by: wheels619 | last post by:
Hi, I have a program that has options to run as both a GUI and a console. The program entry point has a c# file with the "static main...." It checks some parameters, if no parameters, it launches...
3
by: per9000 | last post by:
Hi, I've written a small app that I mostly want to run from the console. Sometimes I want the output in a GUI instead to facilitate a "Save As" feature etc. I created a nice form etc and the...
4
by: Peter Nimmo | last post by:
Hi, I am writting a windows application that I want to be able to act as if it where a Console application in certain circumstances, such as error logging. Whilst I have nearly got it, it...
3
by: Sheikko | last post by:
Sincerly is a little bit complicated to explain to you what I have in my mind, but I will try: Above all the problem is the type of data that I want to passe between these two applications. The...
2
by: Tony Johansson | last post by:
Hello! I have created a Control that consist of a label and a textbox.I have called this class ctlLabelTextbox. public partial class ctlLabelTextbox : UserControl { .... } The class that I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.