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

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,056
Members
48,769
Latest member
Clifft

Latest Threads

Top