Re: Problem sometimes connecting signal/slot in a loop

Florian Bruhin <[email protected]>
Newsgroups gmane.comp.python.pyqt-pykde
Message-ID <[email protected]>
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
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE4E5WAAJAG47w528KkW6wyP1VoHIFAlzea2kACgkQkW6wyP1V
oHLGhA/+NopFDPAPzVQN597VmP/s13+lI0y3Y5L9K7yT7958lK7igFr3x87BVA6c
KD3SXx0nAkM10yfo1GeGkccdMytzx/ETVWRPOFWuJG9i3l/UAFF6IEEOPqouKyuo
G5r5+8y+8YhboA+bNZ4LqJNkHjN3/YFU9DwhlC556k9uBoLahjDh63B21cnJ9KaX
GT2jW+Qj3pPjX37lgF7hbBxMTtbvun+jntTQRCzBBj1MWKPv3UXAMZX7lPNDR6Tz
uMBS5SFUIrIDMHLoTJZXelZJjpaXqcmPwpYzIVA1ot3oQPg4fNZ+Sl8pOakEZpeQ
1utnr1CUe9baC5p+QUFwYx7cTLTyp4nIkkHookv0Yt82moEO+vy6qT5eiqmr6jXe
ZgkVX4dseNLrtQjBxhEfkETBYlPSw8hVGw/KOpk9CZIonbLGvtQTvpCmIll+ObBs
QN97SWr9usbRlHwsf2I1c9RhiNxk/gsU1fz65Lx6RmqH1cAC5+VGOXipNF82SolO
tzN2OaETbQURzI4AXQBXk1wLXp9Po/M4yKLv+LAeCdQKOdxQ2ZtlFuVkIYNAJnZ0
rLmVrA9/8+QMh3AxLRtNumQAHBpfJR+XNYJT/MKFRltInuM/s+1RIsOnsZ4PIKMr
nihR42elRi22/+jyRoy1Ss05OJbUnb+vrWx7BTmeAP3jtNrF91E=
=jRwZ
-----END PGP SIGNATURE-----
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.