[PyQt] Type name for a function / callable when defining a signal
Baz Walter
bazwal at ftml.net
Tue Aug 26 23:04:27 BST 2014
On 26/08/14 22:25, Bryan A. Jones wrote:
> All,
>
> A simple question -- I'd like to define a signal which expects a function
> (or any callable) as an argument to the signal. I'm accustomed to defining
> signals with other parameters, such as
>
> signalName = pyqtSignal(int, str, list, dict)
>
> What's the type for a function?
>
> signalName = pyqtSignal(def?) # nope; not 'function' either.
You could use the types module from the stdlib:
signalName = pyqtSignal(types.FunctionType)
or:
signalName = pyqtSignal(types.MethodType)
But simplest would be:
signalName = pyqtSignal(object)
--
Regards
Baz Walter
More information about the PyQt
mailing list