python - sending colored text to a TextCtrl in wxpython -


I am trying to send color text to the TextCtrl widget, but I do not know how

  Style = wx.TE_MULTILINE | Wx.bordER_SUNKEN | Wx.TE_READONLY | Wx.TE_RICH2 self.status_area = wx.TextCtrl (auto.panel, -1, position = (10, 270), style = style, size = (380,150))  

Basically this snippet Defines a status box in my window, and I want to write a colored log message for it. If I just do self.status_area.AppendText ("blah"), then it adds text as I want, but it will always be black. I can not get the documentation on how to do this.

You need to call SetStyle to call text behavior.

  import wx square F (wx.frame): def __init __ (auto, * args, ** kw): wx.frame .__ init __ (self, none) style = wx . TE_MULTILINE | Wx.bordER_SUNKEN | Wx.TE_READONLY | Wx.TE_RICH2 self.status_area = wx.TextCtrl (auto, -1, position = (10, 270), style = style, size = (380,150)) self.status_area.AppendText ("Blahblahhblah") fg = wx.Colour ( 200,80,100) = wx.TextAttr (fg) self.status_area.SetStyle (3, 5, A) AP = wx.PySimpleApp () F = F () F. Show () App.MainLoop ()  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -