Threads and derived classes

I have a class for a custom graph that is derived from a frame. It
plots image data in pseudo-colour. This data is acquired a a separate
( not main) thread. The data to plot is an attribute of the my new
class. I realise that I can't call the GUI parts of my class from the
alternate thread, but can I set the data to display from it and then
post an event to re-paint the control?

If not, how should I implement such a class?

Thanks

Yes. We also have a function that will make doing that easier, called wx.CallAfter. It works by making an event object that contains the info about a callable to be called and parameters to be passed to it, and then posts that event. The event is then processed in the context of the GUI thread and calls the callable object.

···

On 3/22/12 7:18 AM, PeterW wrote:

I have a class for a custom graph that is derived from a frame. It
plots image data in pseudo-colour. This data is acquired a a separate
( not main) thread. The data to plot is an attribute of the my new
class. I realise that I can't call the GUI parts of my class from the
alternate thread, but can I set the data to display from it and then
post an event to re-paint the control?

--
Robin Dunn
Software Craftsman