···
class Editor(wx.Frame):
def init(self):
wx.Frame.init(self, None)
self.editor = stc.StyledTextCtrl(self)
## register some images for use in the AutoComplete box.
wx.InitAllImageHandlers()
image = wx.Image("icon/class.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
self.editor.RegisterImage(1, image)
image = wx.Image("icon/function.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
self.editor.RegisterImage(2, image)
is working fine. but
class ToolbarFrame(wx.Frame):
def init(self, parent, id):
self.p1 = CT.FileBrowser(self, './work') # wx.GetHomeDir()
self.p2 = MyNotebook(self)
self.Bind(wx.EVT_TOOL, lambda event:self.p2.GetCurrentPage().OnAddPython(event), id=ICON_MENU_BUTTON_PYTHON)
class TestPanel(wx.Panel):
def init(self, parent):
def OnAddPython(self, event=None, idx=0):
...
self.editor = STC(self.scrolled_panel)
class STC(st.StyledTextCtrl):
def init(self, *args, **kwargs):
def OnStyle(self, event):
# Delegate to custom lexer object if one exists
if self.custlex:
self.custlex.StyleText(event)
else:
event.Skip()
def SetLexer(self, lexerid, lexer=None):
"""Overrides StyledTextCtrl.SetLexer
Adds optional param to pass in custom container
lexer object.
"""
self.custlex = lexer
super(STC, self).SetLexer(lexerid)
class VowelLexer(object):
def init(self, lang):
def StyleText(self, event):
...
def displaystyle(lang, stcvar, stvar):
image = wx.Image("./icon/class.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
stcvar.RegisterImage(1, image)
is not working. there is same error.
Wonjun, Choi