Closed abulka closed 5 years ago
I would need to investigate more but it might be bug in wxgtk+PostEvent considering that the synchronous example is not working as well.
I was unable to send a PostEvent for custom or even a CommandEvent with linux/gtk. When I override "ProcessEvent" on the Frame, the event is never seen but I see all the other ones.
Calling QueueEvent on the frame doesn't work either.
Thanks for investigating. I've asked for advice in the wxPython google group on this matter. If it is indeed an underlying wxPython/GTK bug, as it sounds, then its out of our hands! https://groups.google.com/forum/#!topic/wxpython-users/KrRFBJQ6Xy4
Ok, well after all it seems it was wxasync related.
This commit should solve it I think, however I couldn't this on MaxOS yet https://github.com/sirk390/wxasync/commit/7dc0ca77a88e1a09c33b09eececc98b81eb5fd35
You may want to try changing the MainLoop
implementation in wxasync
to be more like what is in this sample: https://github.com/wxWidgets/Phoenix/blob/wxPy-4.0.x/samples/mainloop/mainloop.py (using a custom wx.GUIEventLoop
). I've just updated it with a button to test using wx.PostEvent
and it works for me on all three platforms. I did have to make one other tweak to work around an issue that showed up only on wxGTK, but it actually simplified things a bit for all.
Thanks Robin. This is what helped me initially write the loop.
We think in the same way, as I just added a comment to link to this page in my previous post.
What do you mean by "I've just updated it with a button to test using wx.PostEvent
and it works for me on all three platforms." ? Did you modify wxasync? If you have suggestions, I would be happy to see them
No, I updated the mainloop.py
sample. This is the change: https://github.com/wxWidgets/Phoenix/commit/53219c9e0079e80691155c6d2f5f0db23d72d64f
@sirk390 Your changes to wxasync have fixed the problem. Tested under Ubuntu 18.04 and Mac OS Mojave. Thanks! @RobinD42 Thanks for helping out!
Under Linux, custom events don't seem to get processed, whereas they do under Mac.
Ubuntu 18.04, Python 3.7.1, wxPython installed with
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython
To repro: Use my example app from #3 and emit a custom event by pressing either the sync or async button.
Under Linux, nothing happens as a result of the
wx.PostEvent(self, evt)
- though the print statement indicates that the button handler was triggered. Under Mac, the event triggers messages/behaviour OK.