Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > send event from extension?

Reply
Thread Tools

send event from extension?

 
 
Markus von Ehr
Guest
Posts: n/a
 
      05-27-2004
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
 
Reply With Quote
 
 
 
 
Roger Upole
Guest
Posts: n/a
 
      05-28-2004
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" <(E-Mail Removed)> wrote in message
news:c957po$qrd$(E-Mail Removed)-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



 
Reply With Quote
 
 
 
 
Markus von Ehr
Guest
Posts: n/a
 
      05-28-2004
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" <(E-Mail Removed)> wrote in message
> news:c957po$qrd$(E-Mail Removed)-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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Socket send functions only allow you to send strings? Ryan Parmeter Ruby 4 09-05-2007 03:29 AM
Mail.SmtpMail.Send won't send to one of my addresses Nathan Sokalski ASP .Net 3 11-23-2005 09:25 PM
Pre-Send Request Headers, Pre-Send Request Content =?Utf-8?B?S2V2aW4gQnVydG9u?= ASP .Net 0 12-31-2004 06:29 PM
How to send event to all sessions in ASP .NET ? Borr ASP .Net 2 11-05-2003 04:53 PM
Does Socket.send send all bytes? Chris Reay Ruby 2 11-04-2003 08:22 PM



Advertisments