Storing a callback function as a class member
MRAB
python at mrabarnett.plus.com
Wed Jul 7 18:09:28 EDT 2010
Nathan Huesken wrote:
> Hi,
>
> I have a class, where I want to store a callback function as a member
> to access later:
>
> class CallbackClass:
> def setCallback(self,cb):
> self.cb = cb
>
> def callCallback(self, para):
> self.cb(para)
>
> Doing so, I get the error:
> callbackFunc() takes exactly 1 parameter (2 given)
>
> self is given as parameter this way, is it not? How can this be done?
>
Could you provide a short program which we could run to reproduce the
problem?
More information about the Python-list
mailing list