Trying to add line numbers

RF <[email protected]> Mon, 19 Apr 2021 10:30:37 -0700 (PDT)
Newsgroups gmane.comp.python.wxpython
Message-ID <[email protected]>
I'm trying to add line numbers to my StyledTextCtrl().

That last line below in my code snippet seems to be the correct way to add 
line numbers in the 0 margin but when I run my small app, there are no line 
numbers in the left margin at all. Am I missing a step? Do I have to do 
something else?

My code snippet:

import wx
import wx.stc

class testApp(wx.Frame):
def __init__(self, *args, **kw):
# ensure the parent's __init__ is called
super(testApp, self).__init__(*args, **kw)

self.editor = wx.stc.StyledTextCtrl(self, style=wx.TE_MULTILINE)
self.editor.SetScrollWidth(wx.stc.STC_CACHE_CARET)
#self.stc.EditToggleOvertype()
self.editor.StyleSetSpec(wx.stc.STC_STYLE_DEFAULT, "size:10,face:Courier 
New, fore: #dddddd, back: #000000")
self.editor.SetMarginWidth(1, 20)
self.editor.SetMarginType(0, wx.stc.STC_MARGIN_NUMBER)

self.CreateStatusBar()
self.SetStatusText("Welcome to testApp")

if __name__ == '__main__':
app = wx.App()
win = testApp(None, title='testApp')
win.SetPosition(wx.Point(400, 400))
win.Show()

app.MainLoop()

-- 
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/2018ed76-9f43-41e8-ba42-eee811e6d8e3n%40googlegroups.com.