def addCharacter(self, event): name = self.sNam.GetValue() #Getting the UI out for processing gen = self.sGen.GetValue() age = self.sAge.GetValue() occ = self.sOcc.GetValue() #Checking for blank input if (name == '') or (gen == '') or (age == ''): #Dialogue Box for user input dlg = wx.MessageDialog(None, 'Some Character details are missing', 'Enter values for all text boxes', 'Details missing', wx.OK) dlg.ShowModal() dlg.Destroy() db_program.newCharacter(name, gen, age, occ) print db_program.viewAll() #Clear UI when done self.sNam.Clear() self.sGen.Clear() self.sAge.SetValue(0) self.sOcc.Clear() # Add data to the list control self.fillListCtrl()
def addCharacter(self, event): name = self.sName.GetValue() gen = self.sGen.GetValue() age = self.sAge.GetValue() occ = self.sOcc.GetValue() # Checking if variables have a value if (name == '') or (gen == '') or (age == '') or (occ == ''): # Alert user that a variable is empty 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 # Adding character to database db_program.newCharacter(name, gen, age, occ) print db_program.viewAll() # Empty text boxes when finished. self.sName.Clear() self.sGen.Clear() self.sOcc.Clear() self.sAge.SetValue(0) # Update list control self.fillListCtrl()
def addCharacter(self, event): name = self.sName.GetValue() gen = self.sGen.GetValue() age = self.sAge.GetValue() occ = self.sOcc.GetValue() # Adding character to database db_program.newCharacter(name, gen, age, occ) print db_program.viewAll()
def addCharacter(self, event): name = self.sName.GetValue() gen = self.sGen.GetValue() age = self.sAge.GetValue() occ = self.sOcc.GetValue() # Checking if variables have a value if (name == '') or (gen == '') or (age == '') or (occ == ''): print 'At least one variable is empty' return False # Adding character to database db_program.newCharacter(name, gen, age, occ) print db_program.viewAll()