[wxPython-users] wxStyledTextCtrl_2 woes
David Brown
david at atomicbinary.com
Tue Jul 4 15:29:04 PDT 2006
> I'm working on an editor for the Flat Assembler programming language
> so I need to use the wxStyledTextCtrl_2 for syntax highlighting. I've
> been trying for hours to use the code from the demo, but I keep
> getting errors no matter what I do.
>
> Can someone please provide a simple example of the most minimal way to
> show a wxStyledTextCtrl_2 that is set to fill the empty space of my
> frame and redraw itself when the window is resized (or whatever it has
> to do to update itself)? I would really appreciate it.
>
> Thanks,
> David
Never mind about the above. I finally got it working. My next problem is
that nothing is getting highlighted. :( Here's my code:
import wx
from wx import stc
import keyword
class fsCodeEditor(stc.StyledTextCtrl):
def __init__(self, parent, ID, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=0):
stc.StyledTextCtrl.__init__(self, parent, ID, pos, size, style)
self.SetLexer(stc.STC_LEX_ASM)
self.SetKeyWords(0, " ".join(keyword.kwlist))
self.StyleSetSpec(stc.STC_STYLE_DEFAULT, "face:Courier New,size:10")
self.StyleClearAll()
app = wx.App(0)
frame = fsMainUI(None, -1, "FASM Studio")
ce = fsCodeEditor(frame, -1)
ce.EmptyUndoBuffer()
ce.Colourise(0, -1)
app.MainLoop()
NOTE: There are some classes there that are declared elsewhere. But they
are too long and have nothing to do with the Code Editor.
Most of that is taken directly from the demo. Any ideas?
Thanks,
David
More information about the wxpython-users
mailing list