Storing a callback function as a class member

N

Nathan Huesken

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?

Thanks!
Nathan
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top