def del_problem(self, button): ''' delete a problem from the database and show a success popup ''' # remove problem from databse db.remove_problem(button, conn) self.refresh() # show popup showinfo("Success", "problem #" + str(button) + " has been deleted")
def del_problem(self): ''' delete a problem from the database and show a success popup ''' lb = self.list_box["problems"] # get the index of the selected item selection = lb.curselection() if (selection != ()): # get the item at the index problem = lb.get(selection[0]).split() # remove problem from database db.remove_problem(problem[0], conn) # remove from the list box lb.delete(selection[0]) # show popup showinfo("Success", "problem #" + str(problem[0]) + " has been deleted")
def press(self): #calls a function that tells the user if add was sucessfully, #displays appropriate message on label qid = self.problem_entry.get() message = database_api.remove_problem(qid, sqlite3.connect('ace.db')) print(message) self.feedback_label.config(text="Removed Successfully!")
def test_delete_problem(self): db.add_problem("math", "30+60", "42", conn) db.remove_problem(row + 1, conn)
def tearDown(self): db.remove_problem(row + 1, conn)
def test_delete_non_existant_problem(self): self.assertRaises(sqlite3.OperationalError, lambda: db.remove_problem("hello", conn))