I'm having the problem of a button executing its' command when it's created. To stop this I have got a function, which can stop this behavior
This is the function which makes functions callable without being executed while creating my button. Usually it works fine but with some functions it seems to deny randomly any input! Here is the code:
class Callable(object):
def __init__(self, func, *args, **kwds):
self.func = func
self.args = args
self.kwds = kwds
def __call__(self, *args, **kwds):
return self.func(self.args)
def __str__(self):
return self.func.__name
It seems to be totally randomly which questions are accepted and which aren't. I'm really desperate, because it takes a lot of time to write a kind of synonym of this class, I adapt them with the number of args
and kwds
, then it works ok. But now I'm coming to a point where I don't know how many args I'm going to pass, so this won't work any more.
Question:
- Why does this class doesn't accept every function?
- How can I change this behaviour?