Re: Detect when gui thread comes out of idle state

Tim Roberts <[email protected]>
Newsgroups gmane.comp.python.wxpython
Message-ID <[email protected]>
On Dec 15, 2019, at 7:45 PM, ziltoid the omniscient <[email protected]> wrote:
> 
> Hi, is there a way to detect when the gui thread comes out of the idle state?
> 
> This is the situation it would be useful for:
> 1. Receive EVT_IDLE
> 2. Process custom work queue in gui thread
> 3. Receive "leaving idle event? from wx" after spending time at 2.
> 4. Stop processing custom work queue in gui thread

No, and the reason is clear if you think about it.  If you are doing work in the GUI thread, then obviously the GUI thread is not idle.  The thread can’t check for events in the message queue unless you return from your work so the message loop can run.

If you have custom work to do, you need to do it in a separate thread.  You can use CallAfter to trigger UI updates, if needed.


> On next EVT_IDLE begin steps 1 - 4.

The EVT_IDLE event is issued when the message loop in the GUI thread gets called and there’s nothing in the queue.  If you don’t return to the message loop, then that event cannot be fired.
— 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.

-- 
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/250518C5-4779-4CE8-B2F9-A800012D5F5A%40probo.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.