In QT Designer I have defined a button loadValues_btn and associated the signal pressed() to the custom slot loadValues()
Then in Python, after having loaded the .ui file with the PyQt library, I have defined the method loadValues() in the MainApplication class, in order to execute custom code when the same button is clicked. But it does not execute the code (I need simply to open a File chooser dialog)
I have already tried with clicked() and it didn't work either
Here is the MainApplication class code:
class Main(QMainWindow, Ui_MainWindow):
def __init__(self, ):
super(Main, self).__init__()
self.setupUi(self)
def loadValues():
filePath = QtGui.QFileDialog.getOpenFileName(parent=self, caption='Open file', directory='.')
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
main = Main()
main.show()
sys.exit(app.exec_())