I am using python3 and PyQt4. I want to create a menu with actions, the number of which differs according to an array. I want each of them to save the corresponding information, saved in the array, to a variable. Creating variable number of events seems impossible. So how can i create an event which does different work, according to the action it was activated by? That' s my code:
def buildLoadSettings(self):
self.settings = array
for i in range(len(self.settings)):
exec("self.settings" + str(i) + " = QtGui.QAction('" + self.settings[i][0] + "', self)")
exec("self.loadMenu.addAction(self.settings" + str(i) + ")")
I want to connect each of the actions with an event and finally save the "self.settings[i][1]" to a variable "settings". Sorry for my novice question.