wx.PostEvent() of custom events not working on GTK/Linux

Under Linux, custom events don’t seem to get processed, whereas they do under Mac and Windows. You can PostEvent() them, but they never arrive.

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

Please see reproducible code and comments https://github.com/sirk390/wxasync/issues/4:

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.

Code sample is at https://github.com/sirk390/wxasync/issues/3 but the example could certainly be slimmed down a little. Thus this issue has been confirmed by the authors of wxasync and myself. Can anyone else confirm or comment on this? Should I raise as an issue on wxpython/phoenix?

I rely on custom events in the latest version of my Python UML Pynsource tool for triggering asynchronous rendering of Python UML diagrams using the PlantUML service. The Linux is port has hit a roadblock with this issue, so any thoughts or workarounds would be appreciated.

Can you reproduce the problem in a small sample app that does not use wxasync?

···

On Wednesday, February 27, 2019 at 3:42:03 AM UTC-8, Andy Bulka wrote:

Under Linux, custom events don’t seem to get processed, whereas they do under Mac and Windows. You can PostEvent() them, but they never arrive.

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](https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04) wxPython

Please see reproducible code and comments https://github.com/sirk390/wxasync/issues/4:

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.

Code sample is at https://github.com/sirk390/wxasync/issues/3 but the example could certainly be slimmed down a little. Thus this issue has been confirmed by the authors of wxasync and myself. Can anyone else confirm or comment on this? Should I raise as an issue on wxpython/phoenix?

Robin

Please see my comment at https://github.com/sirk390/wxasync/issues/4

···

Robin

To summarise for others: It turns out that the problem was in the package wxasync after all - not in wxPython GTK. The problem has now been fixed by the wxasync team.

Just in case anyone doesn’t know, wxasync is a library for using Python 3 asyncio (async/wait) with wxPython.

So, apologies for the false alarm - posting custom events work just fine in wxPython on Linux. :slight_smile:

-Andy Bulka

···

Pynsource - UML for Python

Python to RPN - Run Python 3 on vintage HP calculators
My Software Blog on UML, Design Patterns, Python and more

On Thursday, February 28, 2019 at 7:57:07 AM UTC+11, Robin Dunn wrote:

Please see my comment at https://github.com/sirk390/wxasync/issues/4

Robin

If anyone is interested in more information on the wxasync project referred to in this thread, I’ve just published an in-depth article entitled “Async/await for wxPython”
https://medium.com/@abulka/async-await-for-wxpython-c78c667e0872

I’m not the author of wxasync, but am sure glad it exists, and use it in my wxPython projects.

There’s even a demo app in the article showing a fun rubber-band app which draws asynchronously. It was based on some old code examples that I found on the web - I ported to Python 3 and phoenix and added the asynchronous feature.

Andy