code: def OnUpdate(self, event):
          
  
          # Gray out undo and redo id not available
  
          undo_toolid = self.label2id["Undo"]
          redo_toolid = self.label2id["Redo"]
  
          self.EnableTool(undo_toolid, undo.stack().canundo())
          self.EnableTool(redo_toolid, undo.stack().canredo())
  
          # Set ToolTip strings to potential next undo / redo action
          undotext = undo.stack().undotext()
          undo_tool = self.FindTool(undo_toolid)
          if undotext is None:
              undo_tool.SetShortHelp(_("No undo actions available"))
          else:
              undo_tool.SetShortHelp(undotext)
  
          redotext = undo.stack().redotext()
          redo_tool = self.FindTool(redo_toolid)
          if redotext is None:
              redo_tool.SetShortHelp(_("No redo actions available"))
          else:
              redo_tool.SetShortHelp(redotext)
  
          self.Refresh()
  
          event.Skip()
docs: Updates the toolbar states