[Pyrex] lots of callback functions

horace horace3d at gmail.com
Fri May 29 15:28:16 CEST 2009


hi,

i have figured out how to wrap callback functions but i have a special case
which is a bit cumbersome.

i have to wrap a struct which contains events for every key on the keyboard:

cdef extern from "engine.h":
    ctypedef struct ENGINE_VARIABLES:
        EVENT *on_esc
        EVENT *on_f1
        EVENT *on_f2
        EVENT *on_f3
        # ... events for the rest of the keyboard

of course i could write a predefined cdef callback for each single event,
add a variable for storing the user definable python callback (which gets
called from the cdef callback) for each single event and so on.

but maybe someone has an idea how this could be done more elegantly without
so much writing?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.copyleft.no/pipermail/pyrex/attachments/20090529/7b4f5c8c/attachment.html 


More information about the Pyrex mailing list