Re: Problem sometimes connecting signal/slot in a loop

Luna Tuna <[email protected]>
Newsgroups gmane.comp.python.pyqt-pykde
Message-ID <CABhCPev1_NJRV7ohdsffqGcOrSqn6XL493y+V2Uc3LL+G-_Zhw@mail.gmail.com>
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 <[email protected]> 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 | [email protected] (Mail/XMPP)
>    GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
>          I love long mails! | https://email.is-not-s.ms/
>

_______________________________________________
PyQt mailing list    [email protected]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.