Well, after grinding my teeth a lot I was finally able to get the caret to
show in wxPython. For anyone who is interested, here is a wxPython version of
the caret.cpp sample that comes with the wxWindows distribution. (I hope I'm
not stepping on any licensing toes.)
I've added Delete key and Backspace key handling to the original example.
Also, I do not redefine the buffer array each time the frame is resized so the
contents are maintained. HOWEVER, the maximum row and column size is 25 by 80
so don't size the window bigger than that without redefining the array size.
Please, also keep in mind this is the second program I've ever written in
Python. I am still getting use to the language and having a hard time with
all of the variable and class attribute scoping rules. If you find something
in here that could be done better... please let me know.
def OnPaint(self, event):
dc = wxPaintDC(self)
for y in range(0, self.m_yChars):
line = ''
for x in (range(0, self.m_xChars)):
ch = self.m_text[self.CharAt(x,y)]
if ch == ' ':
char = ' '
line = line + ch
dc.DrawText(line, self.m_xMargin, self.m_yMargin + y *