[PyQt] Problem sometimes connecting signal/slot in a loop
Luna Tuna
fruitfulapproach at gmail.com
Fri May 17 14:34:03 BST 2019
Thanks, I'll check it out.
I just made a local function "connectButton" and that does the trick. But
I like the default lambda parameter for more conciseness.
On Fri, May 17, 2019 at 1:06 AM Florian Bruhin <me at the-compiler.org> wrote:
> Hi,
>
> another possibility is using functools.partial instead:
>
> button.clicked.connect(functools.partial(self.show_color_dialog,
> color))
>
> IMHO, this is a nice explanation of the issue and possible solutions:
> https://docs.python-guide.org/writing/gotchas/#late-binding-closures
>
> Florian
>
> --
> https://www.qutebrowser.org | me at the-compiler.org (Mail/XMPP)
> GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
> I love long mails! | https://email.is-not-s.ms/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190517/bf8e5f85/attachment.html>
More information about the PyQt
mailing list