if wx.Platform == '__WXMSW__':
faces = { 'times': 'Times New Roman',
'other': 'Comic Sans MS',
faces = { 'times': 'Times',
'other': 'new century schoolbook',
def GetCursorPos(old, new):
common_length = min(old_length, new_length)
for i in xrange(common_length):
if old_length < new_length:
if common_length > 0 and old[i] != new[i]:
return i + new_length - old_length
return i + new_length - old_length + 1
elif old_length > new_length or i < min(old_length, new_length) - 1:
if common_length > 0 and old[i] != new[i]:
class CustomStyledTextCtrl(wx.stc.StyledTextCtrl):
def __init__(self, *args, **kwargs):
wx.stc.StyledTextCtrl.__init__(self, *args, **kwargs)
self.Bind(wx.EVT_MOTION, self.OnMotion)
def OnMotion(self, event):
if wx.Platform == '__WXMSW__':
x, y = event.GetPosition()
self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))
self.SetCursor(wx.StockCursor(wx.CURSOR_IBEAM))
def AppendText(self, text):
self.GotoPos(self.GetLength())