code: def OnContentChanged(self, event):
          
  
          self.main_window.grid.update_attribute_toolbar()
  
          title = self.main_window.GetTitle()
  
          if undo.stack().haschanged():
              # Put * in front of title
              if title[:2] != "* ":
                  new_title = "* " + title
                  post_command_event(self.main_window, self.main_window.TitleMsg,
                                     text=new_title)
  
          elif title[:2] == "* ":
              # Remove * in front of title
              new_title = title[2:]
              post_command_event(self.main_window, self.main_window.TitleMsg,
                                 text=new_title)
docs: Titlebar star adjustment event handler