I search for a colorable memo component that have "No linewrap" mode.
In Delphi I can set TMemo, TRichEdit to not wrap the text, and I can use HorzScrollBar to show the text fully if use need to see it.
And I can do it same thing in TextCtrl (if I not use the TE_LINE_WRAP style). But I wanna coloring the lines.
You probably should use wx.TE_DONTWRAP, and if you also use the wx.TE_RICH or wx.TE_RICH2 style then you can also set color and font attributes on the text. Or there is the RichTextCtrl that has even more capabilities.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
I search for a colorable memo component that have "No linewrap" mode.
In Delphi I can set TMemo, TRichEdit to not wrap the text, and I can use HorzScrollBar to show the text fully if use need to see it.
And I can do it same thing in TextCtrl (if I not use the TE_LINE_WRAP style). But I wanna coloring the lines.
Thanks for your help:
dd
You should be able to use the style=TE_RICH to change the font colors and styles. See the demo for more info. There's also the FancyText and StyledTextCtrl widgets.
And next question is that how to set the Style to the next text I will append?
For example:
def AppendLog(self, Msg, MsgType = ‘’):
st = wx.TextAttr(“BLACK”)
if MsgType in ['START', 'END']:
st = wx.TextAttr("BLUE")
if MsgType == 'ERROR':
st = wx.TextAttr("RED")
self.rtc_log.SetNextStyle(st)
self.rtc_log.AppendText(Msg + '\n')
In the examples I saw that the SetStyle is need to define the starting and ending position, but it is hard to determine in log.
How to simplify it? Like my pseudo method SetNextStyle(st)…
I search for a colorable memo component that have “No linewrap” mode.
In Delphi I can set TMemo, TRichEdit to not wrap the text, and I can use HorzScrollBar to show the text fully if use need to see it.
And I can do it same thing in TextCtrl (if I not use the TE_LINE_WRAP style). But I wanna coloring the lines.
You probably should use wx.TE_DONTWRAP, and if you also use the wx.TE_RICH or wx.TE_RICH2 style then you can also set color and font attributes on the text. Or there is the RichTextCtrl that has even more capabilities.
And next question is that how to set the Style to the next text I will append?
For example:
def AppendLog(self, Msg, MsgType = ''):
st = wx.TextAttr("BLACK")
if MsgType in ['START', 'END']:
st = wx.TextAttr("BLUE")
if MsgType == 'ERROR':
st = wx.TextAttr("RED")
self.rtc_log.SetNextStyle(st)
self.rtc_log.AppendText(Msg + '\n')
In the examples I saw that the SetStyle is need to define the starting and ending position, but it is hard to determine in log.
How to simplify it? Like my pseudo method SetNextStyle(st)...
Use SetDefaultStyle(st)
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!