Re: process an event without a window

kg*2 <[email protected]> Mon, 26 Feb 2018 14:25:51 -0800 (PST)
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <[email protected]>
I use a background thread to contact a server and then use PostEvent to 
deliver the results to the main thread. This has created a race condition 
where the server thread can sometimes (1 in a 100) return before the main 
window has been created. I'm currently creating a temporary wx.Frame and 
posting the event to that to work around the issue, but I figured there was 
a better way to do it. 

On Monday, February 26, 2018 at 10:56:35 AM UTC-8, Robin Dunn wrote:
>
> On Friday, February 23, 2018 at 12:17:09 PM UTC-8, kg*2 wrote:
>>
>> Is it possible to process a custom event before a window has been 
>> created? 
>>
>
> Maybe, it depends on how you need it to work.  There has to be an object 
> derived from wx.EvtHandler to bind the handler and to receive the event, 
> and unless the MainLoop is running you will only be able to do immediate 
> event processing, not holding the event for processing later. For example, 
> you could bind a handler to the wx.App object, and then send it an event 
> with wx.GetApp().ProcessEvent(event), but with those limitations you may as 
> well just call the method directly.
>
> -- 
> Robin Dunn
> Software Craftsman
> http://wxPython.org
>
>

-- 
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.