[PyQt] Problem sometimes connecting signal/slot in a loop

Florian Bruhin me at the-compiler.org
Fri May 17 09:06:01 BST 2019


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 --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190517/7130b80f/attachment.sig>


More information about the PyQt mailing list