Indicator not showing up in StyledTxtCtrl with Lexer

In the following code, the indicator isn’t shown unless I comment out the SetLexer line.
Is this a bug? Is there a work-around?

import wx, wx.stc

if ‘main’ == name:

app = wx.App()

frame = wx.Frame(None)
panel = wx.Panel(frame)

editor = wx.stc.StyledTextCtrl(panel)

editor.SetLexer(wx.stc.STC_LEX_PYTHON)

editor.SetText("testing testing testing")

editor.IndicatorSetStyle(0, wx.stc.STC_INDIC_PLAIN)
editor.IndicatorSetForeground(0, wx.RED)

editor.StartStyling(1, wx.stc.STC_INDICS_MASK)
editor.SetStyling(10, wx.stc.STC_INDIC0_MASK)


sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(editor, proportion=1, flag = wx.EXPAND)
panel.SetSizer(sizer)

frame.Show()   
app.MainLoop()

Forgot to mention:
wxPython 2.8.8.1 (gtk2-unicode)
Ubuntu 8.04

···

On Fri, Sep 5, 2008 at 4:42 PM, Jesse Aldridge jessealdridge@gmail.com wrote:

In the following code, the indicator isn’t shown unless I comment out the SetLexer line.

Is this a bug? Is there a work-around?

import wx, wx.stc

if ‘main’ == name:

app = wx.App()

frame = wx.Frame(None)
panel = wx.Panel(frame)

editor = wx.stc.StyledTextCtrl(panel)

editor.SetLexer(wx.stc.STC_LEX_PYTHON)

editor.SetText("testing testing testing")



editor.IndicatorSetStyle(0, wx.stc.STC_INDIC_PLAIN)
editor.IndicatorSetForeground(0, wx.RED)

editor.StartStyling(1, wx.stc.STC_INDICS_MASK)
editor.SetStyling(10, wx.stc.STC_INDIC0_MASK)



sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(editor, proportion=1, flag = wx.EXPAND)
panel.SetSizer(sizer)

frame.Show()   
app.MainLoop()

# only accepts old style indicators,
    # Python Lexer only allows Indicator-2

cheers,
Stef

Jesse Aldridge wrote:

···

In the following code, the indicator isn't shown unless I comment out the SetLexer line.
Is this a bug? Is there a work-around?

import wx, wx.stc

if '__main__' == __name__: app = wx.App()
     frame = wx.Frame(None)
    panel = wx.Panel(frame)
       editor = wx.stc.StyledTextCtrl(panel)
       editor.SetLexer(wx.stc.STC_LEX_PYTHON)
       editor.SetText("testing testing testing")

    editor.IndicatorSetStyle(0, wx.stc.STC_INDIC_PLAIN)
    editor.IndicatorSetForeground(0, wx.RED)

    editor.StartStyling(1, wx.stc.STC_INDICS_MASK)
    editor.SetStyling(10, wx.stc.STC_INDIC0_MASK)
       sizer = wx.BoxSizer(wx.HORIZONTAL)
    sizer.Add(editor, proportion=1, flag = wx.EXPAND)
    panel.SetSizer(sizer)

    frame.Show() app.MainLoop()
------------------------------------------------------------------------

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Thanks, it works! Here’s the fixed snippet for the record:

import wx, wx.stc

if ‘main’ == name:
app = wx.App()

frame = wx.Frame(None)
panel = wx.Panel(frame)


editor = wx.stc.StyledTextCtrl(panel)

editor.SetLexer(wx.stc.STC_LEX_PYTHON)

editor.SetText("testing testing testing")

editor.IndicatorSetStyle(2, wx.stc.STC_INDIC_PLAIN)


editor.IndicatorSetForeground(0, wx.RED)

editor.StartStyling(1, wx.stc.STC_INDICS_MASK)
editor.SetStyling(10, wx.stc.STC_INDIC2_MASK)

sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(editor, proportion=1, flag = wx.EXPAND)

panel.SetSizer(sizer)
frame.Show()

app.MainLoop()

oops, the line
editor.IndicatorSetForeground(0, wx.RED)
should be
editor.IndicatorSetForeground(2, wx.RED)

···

On Fri, Sep 5, 2008 at 5:48 PM, Jesse Aldridge jessealdridge@gmail.com wrote:

Thanks, it works! Here’s the fixed snippet for the record:

import wx, wx.stc

if ‘main’ == name:
app = wx.App()

frame = wx.Frame(None)
panel = wx.Panel(frame)


editor = wx.stc.StyledTextCtrl(panel)

editor.SetLexer(wx.stc.STC_LEX_PYTHON)

editor.SetText("testing testing testing")

editor.IndicatorSetStyle(2, wx.stc.STC_INDIC_PLAIN)

editor.IndicatorSetForeground(0, wx.RED)

editor.StartStyling(1, wx.stc.STC_INDICS_MASK)

editor.SetStyling(10, wx.stc.STC_INDIC2_MASK)

sizer = wx.BoxSizer(wx.HORIZONTAL)

sizer.Add(editor, proportion=1, flag = wx.EXPAND)

panel.SetSizer(sizer)
frame.Show()

app.MainLoop()