Events happening when the program window isn't active

I have a program which needs to respond to events from external sources, and if an alarm event is raised, to pop up an alert dialog (amongst other things). I’ve tried to achieve this much like the code in the process demo program, but rather than calling, I call a pythonscript which subscribes to a zeroMQ message queue and puts any received messages to stdout.

This is working fine when my application is the active window, but if it is not, then it doesn’t receive the alerts until the mouse is moved over the application window, or until the window is restored if it were minimised.

Is there some way that the idle loop can be set to execute periodically, even when the application is minimised, or not the active window? Alternatively, is there some other method for responding to external events which would work better?


This is running on Windows BTW.

I think I’ve almost figured this out myself. I’m having more success with declaring the called process as a Thread, and returning results with wx.PostEvent.

Now if I can just figure out how to interrupt the call in the thread to recv_multipart when the program is closed :smile:

How about using a daemon thread?

Yes, that seems to work well, when closing the application, the thread is getting closed if it is declared as a daemon.