I am a beginner to PyQt5, I use Python for a long time to create simple algorithms. However, this time I created a simple GUI program with PyQt5 to show up data that are saved in an SQLITE3 database. And then I created an input box along with a push-button which makes a click event to receive data typed in the input box, and save that in the SQLITE3 database. But, once I click the push-button, it makes more than one method call, and then the same data is getting saved too many times in the database. I don’t know why this is happening.
This is my python code for connecting the clicked method with the button
This is my addModel method
modelName = self.ui.model_page_add_model_input.text() model = Model(modelName) m = OfficeMemberController() m.addAModel(model) self.ui.model_page_add_model_input.clear() result = self.staffController.viewAvailableModels() self.loadModelTable(result)
here the OfficeMemberController class contains the query method for inserting the data to the database.
the loadModelTable method is used to show the available data in the database on a QTableWidget
Anyone knows, why the click method is getting called too many times for a single click of the push button???