code: def OnButtonCell(self, event):
          
  
          # The button text
          text = event.text
  
          with undo.group(_("Button")):
              self.grid.actions.set_attr("button_cell", text)
  
          self.grid.ForceRefresh()
  
          self.grid.update_attribute_toolbar()
  
          event.Skip()
docs: Button cell event handler