En Thu, 26 Jul 2007 12:18:04 -0300, m2i3k <[EMAIL PROTECTED]> escribió:

> I have C code with requires me to register a python callback. I am
> able to get the callback working well using ctypes if I use global
> functions without any context argument for the callback.
>
> Now I want to register a python class member function for callback,
> and give "self" as the context argument at the time of callback
> registration. Then the c code can invoke the callback with self as the
> context argument

Use a bound method as the callback -that is, get the method from an  
instance, not from the class-.
Pass it the same way as you would pass a global function; you get the  
"self" argument for free :)

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to