[PyQt] Very weird behaviour with a new style slot

Jeremy Sanders jeremy at jeremysanders.net
Sun Apr 6 17:32:42 BST 2014


Phil Thompson wrote:

> Qt4 implements signals with optional arguments as multiple signals.
> PyQt considers the default as the version with all arguments specified -
> that's the one you are now connecting to. To connect to the one your old
> code was connecting to do...
> 
>      button.clicked[()].connect(...

Thanks Phil. That's slightly mind-expanding! Here's a workaround:

            def wrap(text):
                return lambda: self.doClicked(text)
            button.clicked.connect(wrap(t))

Jeremy




More information about the PyQt mailing list