0

I am looking for a widget under wx that is similar to TextCtrl with the capabilities to show rich content under Linux and Mac (e.g. different text colors in different lines). I know that wx.TextCtrl with wx.TE_RICH style (or wx.RichTextCtrl) only works under Windows, and not under Mac and Linux.

I have also checked stc.StyledTextCtrl which seems to have the desired capability, given a schema for coloring, so it is mainly used for syntax highlighting. So, I doubt that it works.

So, I was wondering if there is a text box widget TB for wx with an API like:

TB.AppendText("Hello, this is Black", wx.BLACK)
TB.AppendText(" and this is Blue", wx.BLUE)

Any help is appreciated.

happyhuman
  • 1,541
  • 1
  • 16
  • 30

1 Answers1

0

Um, what gave you that idea? The rich text flag for the wx.TextCtrl works fine on Linux for me. I'm using wxPython 2.8.12.0. You may have to use wx.TE_RICH2 though. I was testing using the wxPython demo to see if it worked and it does.

The RichText control in wx.richtext also works as does the FancyText and StyleTextCtrls. I am testing on CentOS 6.

Mike Driscoll
  • 32,629
  • 8
  • 45
  • 88
  • Thanks for the reply. The description for wx.TextCtrl (http://docs.wxwidgets.org/2.8/wx_wxtextctrl.html) mentions that wx.TE_RICH and wx.TE_RICH2 styles are ignored under platforms other than Win32. I also tried using wx.TE_RICH and wx.TE_RICH2 in my code that runs under Mac, but the texts were not colored differently. – happyhuman Dec 03 '13 at 19:14
  • stc.StyledTextCtrl does work under Mac, but it seems to require a schema for coloring and it has no API to color a text as it is being appended. – happyhuman Dec 03 '13 at 19:14
  • Have you looked at the wxPython demo to see if any of those widgets work on Mac? I don't have a Mac to test with. – Mike Driscoll Dec 03 '13 at 19:19