original_docstring: Updates the file to apply changes made by the user
docstring: Updates the file to apply changes made by the user
docstring_tokens: Updates the file to apply changes made by the user
code: def update(self, event=None):
          global questionList
          '''Updates the file to apply changes made by the user'''
  
          newcolour = self.buttoncolour
          newname = self.categoryname.get()
  
          if newcolour == '' or newcolour is None:
              newcolour = main.colour
  
          if newname == '' or newname == 'Category... Animals':
              messagebox.showinfo(message='Make sure all entries aren\'t empty or have the default text inside them')
              return
  
          if newname in category and newname != main.category:
              if not messagebox.askyesno(message='There are categories/is a category with this chosen name, would you like to join them together?'):
                  return
  
          c.execute('DELETE FROM subjects WHERE subject = (?)', (main.category,))
          c.execute('INSERT INTO subjects VALUES (?, ?)', (newname, newcolour))
          c.execute('UPDATE questions SET subject = (?) WHERE subject = (?)', (newname, main.category))
          conn.commit()
  
          messagebox.showinfo(message='Category Updated! The app will now restart :)')
  
          self.window.destroy()
          main.refreshlist()
          main.window.destroy()
          main.changecategory()
code_tokens: def update ( self , event = None ) : global questionList newcolour = self . buttoncolour newname = self . categoryname . get ( ) if newcolour == '' or newcolour is None : newcolour = main . colour if newname == '' or newname == 'Category... Animals' : messagebox . showinfo ( message = 'Make sure all entries aren\'t empty or have the default text inside them' ) return if newname in category and newname != main . category : if not messagebox . askyesno ( message = 'There are categories/is a category with this chosen name, would you like to join them together?' ) : return c . execute ( 'DELETE FROM subjects WHERE subject = (?)' , ( main . category , ) ) c . execute ( 'INSERT INTO subjects VALUES (?, ?)' , ( newname , newcolour ) ) c . execute ( 'UPDATE questions SET subject = (?) WHERE subject = (?)' , ( newname , main . category ) ) conn . commit ( ) messagebox . showinfo ( message = 'Category Updated! The app will now restart :)' ) self . window . destroy ( ) main . refreshlist ( ) main . window . destroy ( ) main . changecategory ( )
short_docstring: Updates the file to apply changes made by the user
short_docstring_tokens: Updates the file to apply changes made by the user
comment: '''Updates the file to apply changes made by the user'''