I am using PyQt and want to create a menu based on a list of strings.
The problem is that when I want to call 'addAction', it requires a callback function (for each line) that takes no arguments.
For simple menus, this will be good: for example.
menu.addAction("Open", self.open) menu.addAction("Exit", self.quit)
However, I just want to use one function and pass an action string as an argument.
I am wondering if python can do something like this:
def f(x, y): print x + 2*y
Here is my code snippet:
def printParam(parameter): print "You selected %s" % parameter
Any suggestions that were highly appreciated
source share