send event from extension?

Discussion in 'Python' started by Markus von Ehr, May 27, 2004.

  1. 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
     
    Markus von Ehr, May 27, 2004
    #1
    1. Advertising

  2. Markus von Ehr

    Roger Upole Guest

    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" <> wrote in message
    news:c957po$qrd$-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
     
    Roger Upole, May 28, 2004
    #2
    1. Advertising

  3. 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" <> wrote in message
    > news:c957po$qrd$-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
     
    Markus von Ehr, May 28, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anand
    Replies:
    3
    Views:
    903
    Tim Daneliuk
    Nov 8, 2003
  2. Christian Seberino
    Replies:
    3
    Views:
    1,191
    Christian Seberino
    Feb 5, 2004
  3. Steve
    Replies:
    3
    Views:
    27,006
    Steve
    Aug 25, 2006
  4. Elhanan
    Replies:
    0
    Views:
    556
    Elhanan
    Jan 23, 2007
  5. llothar
    Replies:
    17
    Views:
    1,263
    Steve Holden
    Apr 7, 2008
Loading...

Share This Page