code: def OnToggleTool(self, event):
          
  
          config["check_spelling"] = str(event.IsChecked())
          toggle_id = self.parent.menubar.FindMenuItem(_("View"),
                                                       _("Check spelling"))
          if toggle_id != -1:
              # Check may fail if translation is incomplete
              toggle_item = self.parent.menubar.FindItemById(toggle_id)
              toggle_item.Check(event.IsChecked())
  
          self.parent.grid.grid_renderer.cell_cache.clear()
          self.parent.grid.ForceRefresh()
  
          event.Skip()
docs: Tool event handler