def addToDb(self): try: #Adding variable names to the text boxes on add information windows FoodType = self.ui.lineEditFood.text() Calories = self.ui.lineEditCalories.text() Grams = self.ui.lineEditGrams.text() mealType = "Breakfast" #Stores the user ID as a variable and removes the excess string UserID = self.userID UserID = str(UserID) UserID= (UserID.replace("(","")) UserID = (UserID.replace(")", "")) UserID = (UserID.replace(",", "")) #Validation Check. if (SQLStatements.addFood(FoodType,Calories,Grams,mealType,UserID) == 'True'): QMessageBox.about(QMessageBox(), 'Success', 'added to the database.') else: QMessageBox.warning(QMessageBox(), 'Error', 'Could not be added') except Exception as e: print (e)