Here's some basic code to get you going... you will need to update self.lastPrompt yourself... I guess some time after an EVT_TEXT_ENTER is pressed... or best after you print a new >>> prompt:
t3 = wx.TextCtrl(self, -1,
"Here is a looooooooooooooong line of text set in the control.\n\n"
"The quick brown fox jumped over the lazy dog...>>>",
size=(200, 100), style=wx.TE_MULTILINE|wx.TE_PROCESS_ENTER)
t3.SetInsertionPoint(t3.GetLastPosition())
self.lastPrompt = t3.GetLastPosition()
self.Bind(wx.EVT_TEXT, self.EvtText, t3)
self.Bind(wx.EVT_TEXT_ENTER, self.EvtTextEnter, t3)
t3.Bind(wx.EVT_CHAR, self.OnChar)
def OnChar(self, event):
#disable backspace for positions less than or equal to the last char of >>>
if event.GetEventObject().GetInsertionPoint() <= self.lastPrompt and event.GetKeyCode() == 8:
return False
#disable entering text only before the >>>, text can be entered at/after this
elif event.GetEventObject().GetInsertionPoint() < self.lastPrompt:
return False
#do default behaviour for all other cases
else:
event.Skip()