Roger Upole schrieb:
You could use win32event.CreateEvent and pass the handle into your
extension,
call SetEvent in the c code, and use win32event.WaitForSingleObject to wait
for
the signal. Alternately, you could create a named event and call OpenEvent
to
get a handle instead of passing it around.
hth
Roger
"Markus von Ehr" <vo****@ipm.fhg.de> wrote in message
news:c9**********@news2.rz.uni-karlsruhe.de...
Hi everybody,
I'd like to create an event which I have to post/set
within an extension (new frame signal from a camera).
In python I would like to react on this event.
How could I create and post the event in c and
how could I receive it in a python event handler
routine done with the win32event module?
Thanks for any answer,
Markus
Hi Roger,
I don't know how to pass the handle. Is only the event.handle
important? And how to wait for the event?
Do I have to verify that the correct event fired my
WaitForSingleObject?
Can you help me?
I do the following in my python code:
import win32event
..
..
..
evt = win32event.CreateEvent(None, 0, 0, None)
# pass event to c-extension
cam_ext.SetEvent(evt.handle)
# and wait for the event
win32event.WaitForSingleObject(evt)
###########################################
// c-extension
int event;
PyObject *cam_ext_SetEvent(PyObject *pSelf, PyObject *pArgs)
{
if (!PyArg_ParseTuple(pArgs, "i", &event))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
// Set the event
::SetEvent(event);
Do you think it's correct? generally SetEvent needs an event object and
not only a number?
Thanks for hints,
Markus