OnPaint not in main thread

Folks

I'm still trying to find my problem with threads and my wxPython app. I've put a print statement in the OnPaint of the canvas that I'm doing wx.DC draws. Sometimes, the OnPaint event is in the main thread and sometimes it is not (which using means a crash). This only happens on OSX and never on any of the other UNIX machines. I've also put prints into my wx.PostEvent functions and the same things happens. Not all wx.PostEvents are going to the main thread.

I haven't got an example to post and I'll try to make one but surely this is a fundamental problem with the threading and wx.PostEvent mechanism on Macs.

Nigel

···

---
Nigel W. Moriarty

____________________________________________________________________________________
Now that's room service! Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097

Nigel W. Moriarty wrote:

Folks

I'm still trying to find my problem with threads and my wxPython app.
I've put a print statement in the OnPaint of the canvas that I'm
doing wx.DC draws. Sometimes, the OnPaint event is in the main
thread and sometimes it is not (which using means a crash). This
only happens on OSX and never on any of the other UNIX machines.
I've also put prints into my wx.PostEvent functions and the same
things happens. Not all wx.PostEvents are going to the main thread.

I haven't got an example to post and I'll try to make one but surely
this is a fundamental problem with the threading and wx.PostEvent
mechanism on Macs.

Yes, that would certainly be a problem, although I'll definitely need a sample of it in action. I tried adding some "assert wx.Thread_IsMain()" statements in various places in some code that uses worker threads and the assert never triggered.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!