The text buffers context menu can be customized through an API provided by the Editra Message System. See the below example for usage.
import wx import ed_msg ID_MY_MENU_ID = wx.NewId() def OnCustomizeBufferMenu(msg): data = msg.GetData() menu = data.GetMenu() menu.Append(ID_MY_MENU_ID, "Hello World") data.AddHandler(ID_MY_MENU_ID, MyMenuHandler) ed_msg.Subscribe(OnCustomizeBufferMenu, ed_msg.EDMSG_UI_STC_CONTEXT_MENU) def MyMenuHandler(text_buffer, event): wx.MessageBox("Hello World")