I've been having some trouble with a set of dynamically created buttons in PyQT.
I'm using a list to create buttons corresponding to different values. Because each button is different, I need to have them pass an argument to the "Button Clicked" function identifying themselves separately so I can perform different actions with them. Here is what I have so far:
for x in self.buttons:
    name = str(x)
    button = QtGui.QPushButton(Frame)
    button.setText(name)
    cp_result = self.changeProject(name)
    if cp_result is None:
        print 'changeProject(%s) is None!', name
    else:
        print 'changeProject(%s) is OK (%r)', name, cp_result
        #button.clicked.connect(cp_result)
    setattr(self, "btn_%s" % name, button)
    self.btnList.append(button)
def changeProject(self, name):
    for x in self.btnList:
        if x.isDown:
            #Change UI Frame to blahblah
    return 'A String'
Working with Alex, this is the latest code, testing a return value on changeProject, which clearly cannot be a string, but I still need to determine which button is pressed between the auto-generated buttons.
Current error: TypeError: connect() slot argument should be a callable or a signal, not 'str'
 
     
     
    