On Wed, 2008-08-20 at 15:17 -0400, Daniel Miller wrote:
> Ahh, sorry, that will have the same problem you had before. Here's a  
> better version:

:-)

> def slotmaker(button):
>      def slot():
>          self.button_clicked(button)
>      button.__slot = slot
> 
> for button in [ ... ]:
>      QtCore.QObject.connect( ... , slotmaker(button))
> 
> 
> Note: it might not be possible to keep a reference to the slot on the  
> button itself--not sure if attribute assignment is possible directly  
> on qt objects that are not subclassed in Python. If not just keep a  
> list of slots attached to 'self' (your class) or something like that.

So all I am seeing is that these things of anonymous/lambda functions
are evil in Python, because of the lexical/binding thing...

Anyway, your other email seems to have a better way of solving this, and
it's now working great. So thank you for your help :-)

Ruben

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to