I created a calculator using PyQt5 designer, in the logic part written in Python each button call a class to add the corresponding symbol like this:
self.button_0.clicked.connect(self.push0)
self.button_1.clicked.connect(self.push1)
def push0(self):
t=self.display.toPlainText()
self.display.setText(t+"0")
def push1(self):
t=self.display.toPlainText()
self.display.setText(t+"1")
But if i try to write one function for all of them like:
self.button_0.clicked.connect(self.push(self, '0'))
self.button_0.clicked.connect(self.push(self, '1'))
def push(self, c):
t=self.display.toPlainText()
self.display.setText(t+c)
I get the message "TypeError: push() takes 2 positional arguments but 3 were given" What's the problem? Thans to everyone already