In my Pyqt4 program I want to change the shortcut for some buttons. As I have quite a lot I thought of accessing a button through user input. I copied the relevant code snippets.
self.btn3 = QtGui.QPushButton(self)
b, ok = QtGui.QInputDialog.getText(self, 'Keyboard Mapping',
"Enter button number: ")
so the user would, say, input "btn3", and then in another input dialog he'd specify the new shortcut. Finally, I want to change the button shortcut like this:
self.b.setShortcut(newkey)
I get an error that my QMainWindow Class has no attribute "b".
Is there no way of storing an instance in a variable? Or maybe reading the variable or something? I'd be glad if you can help me...
self.b, why do you think it exists? Did you meantself.btn3?