Save the object of where right-clicked was performed, then setFocus after selecting Paste. The reason why event.GetEventObject().SetFocus() does not work is most likely because after selecting Paste from the PopupMenu, the TextCtrl loses focus. So text would not print there
def OnShowPopup(self, event):
""" Obtain right-click selection """
pos = event.GetPosition()
pos = self.panel.ScreenToClient(pos)
self.rightClickSelected = event.GetEventObject()
self.panel.PopupMenu(self.rightClickMenu, pos)
def OnPaste(self, event = None):
""" Paste content from clipboard """
self.rightClickSelected.SetFocus()
if isinstance(self.rightClickSelected, wx.TextCtrl):
self.rightClickSelected.Paste()