Modal dialogs and threads on Mac OS X with wxPython 3.0

Hi,

I’m attaching a wxPython test which works for me on wxPython 2.8 on Mac OS X but fails on wxPython 3.0 on Mac OS X. The attached code attempts to illustrate a problem I’m having in a much larger application. Basically, after a modal dialog session has ended, I can no longer use wx.CallAfter effectively to post events to the main thread.

What I expect to see, (assuming that I click the OK button when it appears), and what I see with wxPython 2.8 is:

testWorker1: Writing stdout from TestWorker1Thread
testWorker1: Writing stdout from MainThread.
TestDialog returned wx.ID_OK. Thread is MainThread
testWorker2: Writing stdout from TestWorker2Thread
testWorker2: Writing stdout from MainThread.

``

And then after sleeping for 5 seconds, the program exits when using wxPython 2.8.

But with wxPython 3.0, the program never exits and never displays the final line of text - it appears to freeze up when wx.CallAfter is called from testWorker2:

testWorker1: Writing stdout from TestWorker1Thread
testWorker1: Writing stdout from MainThread.

TestDialog returned wx.ID_OK. Thread is MainThread

testWorker2: Writing stdout from TestWorker2Thread

``

Notice the missing “testWorker2: Writing stdout from MainThread” in the wxPython 3.0 output.

Is this a bug, or am I doing something wrong?

The sleep times in the code are a bit arbitrary - I’m just trying to give the application enough time to start up its main loop before attempting to exit.

For the successful wxPython 2.8 test, I used: Python 2.7.9 (32-bit), wxPython 2.8.12.1, Mac OS X 10.9

For the unsuccessful wxPython 3.0 test, I used: Python 2.7.8 (32-bit/64-bit), wxPython 3.0.2.0, Mac OS X 10.7

Thanks in advance,

James

TestApp.py (1.72 KB)