def updateCharacter(self, event): db_program06.deleteCharacter(self.selectedId) name = self.sName.GetValue() lastName = self.slastName.GetValue() gen = self.sGen.GetValue() age = self.sAge.GetValue() occ = self.sOcc.GetValue() #Check if variables have values if (name == '') or (lastName == '') or (gen == '') or (age == '') or (occ == ''): dlg = wx.MessageDialog(None, \ 'Some character details are missing. Enter values in each text box.', \ 'Missing Details', wx.OK) dlg.ShowModal() dlg.Destroy() return False #Add character to the database db_program06.newCharacter(name, lastName, gen, age, occ) print db_program06.viewAll() #Empty boxes when finished self.sName.Clear() self.slastName.Clear() self.sGen.Clear() self.sOcc.Clear() self.sAge.Clear() self.fillListCtrl()
def onDelete(self, event): #Delete the character db_program06.deleteCharacter(self.selectedId) #Refresh the table self.fillListCtrl()