Sirs.
I have pretty much simple PyQT5 app. I have dynamically created buttons and connected to some function.
class App(QWidget):
...
def createButtons(self):
...
for param in params:
print("placing button "+param)
button = QPushButton(param, checkable=True)
button.clicked.connect(lambda: self.commander())
And I have the commander method:
def commander(self):
print(self.sender().text())
So I have access to clicked button. But what if I want to access previously clicked button? Or another element in main window? How to do it?
What I want:
def commander(self):
print(self.sender().text())
pressedbutton = self.findButtonByText("testbutton")
pressedbutton.setChecked(False)
Or
pressedbutton = self.findButtonBySomeKindOfID(3)
pressedbutton.setChecked(False)
Any help will be appreciated!