[wxPython-users] wxStyledText questions...

Josiah Carlson jcarlson at uci.edu
Sat Dec 2 00:56:42 PST 2006


Greg Skelhorn <gskelhorn at eastlink.ca> wrote:
> Hi,
> 
> I am trying to use the wxStyledTextCtrl to create styled view
> of files from our data collectors. The format is rather verbose
> but primarily numeric (see below for example).
> 
>  From what I have found via google searches I believe I want
> to set the stc lexer to SCLEX_CONTAINER and write the
> logic for my custom syntax styling in an event handler for
> SCN_STYLENEEDED.

In wxPython, when using the 'import wx.stc as stc', the names are
stc.STC_LEX_CONTAINER and stc.EVT_STC_STYLENEEDED, used like so:

import wx.stc as stc

class mystc(stc.StyledTextCtrl):
    ...
    def setup(self):
        ...
        self.SetLexer(stc.STC_LEX_CONTAINER)
        self.Bind(stc.EVT_STC_STYLENEEDED, self.OnStyle)
        ...

    def OnStyle(self, evt):
        ...
        #to see what information is available, use dir(evt)

> Am I on the right path? Can anyone point me to
> some docs or a similar example?

I'm sorry, I haven't personally used it, and I don't remember seeing
anyone with a Python + wxPython example.

 - Josiah





More information about the wxpython-users mailing list