Clarification re: Question on Serial Port / ISR

Grant and Roger propose two slightly different ways of
allowing the serial port process to notify the main thread;
both approaches use secondary threads. Grant suggests using
wx.CallAfter, while Roger suggests using wx.PostEvent. I am
still somewhat new to Python, but from reading the
documentation on these two functions, they appear to work
quite similarly. What are the differences between these two
approaches that would affect my decision about which one to
implement?

IIRC, CallAfter is wxPython-specific (doesn't exist in
wxWidgets). I believe that PostEvent allows you to create any
kind of event you want, so it's completely general and invokes
the same event-handling mechanism as other GUI events. This
means 1) you can use it to do just about anything, and 2) you
got to provide some "glue" to stick things together (event id's
event bindings, etc.).

CallAfter, OTOH, just calls what you tell it to the next time
there's some free time. Much simpler, but less generalized.

Also, the documentation on CallAfter is a little obscure - it simply
says CallAfter(callable, *args, **kw). Can anyone tell me exactly how
I'd call this function if I wanted to invoke an object's method (eg,
called Notify)? Would it simply be:

CallAfter( instrument.Notify ), where instrument is the name of the object?

Yup, that's it -- assuming that the Notify method doesn't
require any parameters other than the default "self".

ยทยทยท

On Mon, Jun 21, 2004 at 03:32:16PM -0700, Antony Hodgson wrote:

--
Grant Edwards
grante@visi.com