I have a list of strings and want to create a menu entry for each of those strings. When the user clicks on one of the entries, always the same function shall be called with
This should work, but I'm pretty sure there was a better way that I can't recall right now.
def do_stuff_caller(self, item):
return lambda: self.doStuff(item)
...
self.connect(entry, QtCore.SIGNAL('triggered()'), self.do_stuff_caller(item))
Edit: Shorter version, that still isn't what I'm thinking about... or maybe it was in another language? :)
(lambda x: lambda self.do_stuff(x))(item)