I'm attemping to setup a function that will create QActions and connect them with methods. The methods that I pass vary in terms of arguments that they receive. Is there a way to pass all individual arguments from a tuple (args) into a function regardless of the quantity? I already have most of my code written, so I don't want to change all of my methods at this point.
In the absence of a solution, I have the below:
def action_gen(self, menu, text, method, *args, passing=0):
action= QAction(text)
menu.addAction(action)
if passing == 0:
base.triggered.connect(method)
elif passing == 1:
base.triggered.connect(lambda: method(args[0]))
elif passing == 2:
base.triggered.connect(lambda: method(args[0], args[1]))
self.all_actions[text] = base
return```