Hi, I've tried searching around for other problems similar to mine, and I was unable to find any. I seem to not be able to "color" text in a TextCtrl widget on Windows, but I can on Linux. I have a little screenshot and some code to show this:
Code:
#!/usr/bin/python
import wx
class MainWindow(wx.Frame):
def __init__(self, parent, title, size_):
wx.Frame.__init__(self, parent, title=title, size=size_)
self.textArea = wx.TextCtrl(self, style=wx.TE_MULTILINE)
self.textArea.AppendText("This text should be colored.")
self.textArea.SetFocus()
self.Show()
self.colorText()
def colorText(self):
self.textArea.SetStyle(5, 9, wx.TextAttr("#ff9c00", "#000000"))
app = wx.PySimpleApp()
frame = MainWindow(None, "Example", (400,300))
app.MainLoop()
Is the SetStyle method not supported on Windows or what? Is there any way I could get around this problem? I think a while ago I read about being able to do this when you initiate the TextCtrl instance (line 8 of my code), by setting "style" equal to some special styling format, but I'm not positive about that.
Thanks in advance.