code: def OnMerge(self, event):
          
  
          with undo.group(_("Merge cells")):
              self.grid.actions.merge_selected_cells(self.grid.selection)
  
          self.grid.ForceRefresh()
  
          self.grid.update_attribute_toolbar()
docs: Merge cells event handler