[PyQt] Creating an action with a "verbose" signal

Aaron Digulla digulla at hepe.com
Fri Jan 25 10:04:03 GMT 2008


Quoting Martin Höfling <martin.hoefling at gmx.de>:

> Here come's the problem: For each file i create a QAction object, add this to
> the menu and connect it's "triggered()" signal with a python function blubb.
> The problem is to distinguish from which QAction/File blubb has been called.
>
> Any hint's how to solve this?

Put a lambda in between:

    for filename in ...:
        self.connect(action, SIGNAL("triggered()"),
                lambda self, filename: self.blubb(filename))

Regards,

-- 
Aaron "Optimizer" Digulla a.k.a. Philmann Dark
"It's not the universe that's limited, it's our imagination.
Follow me and I'll show you something beyond the limits."
http://www.pdark.de/



More information about the PyQt mailing list