code: def OnPaste(self, event):
          
  
          data = self.main_window.clipboard.get_clipboard()
  
          focus = self.main_window.FindFocus()
  
          if isinstance(focus, wx.TextCtrl):
              # Paste into TextCtrl if in focus
              focus.WriteText(data)
  
          else:
              # We got a grid selection
              key = self.main_window.grid.actions.cursor
  
              with undo.group(_("Paste")):
                  self.main_window.actions.paste(key, data)
  
          self.main_window.grid.ForceRefresh()
  
          event.Skip()
docs: Clipboard paste event handler