I’m trying to add line numbers to my StyledTextCtrl().
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 test appt:
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()