Hello Dev,
I want to change font colour in wx.RichTextCrtl, but I find the way it is used in wxDemo is complicated with no code to explain. Is there simple way to do it? If there is no other way, can someone explain the way it is done in demo TALKally (with comments)?
Thanks alot!

9 Years
Discussion Span
Last Post by Stefano Mtangoo

This didn't make any sense?

self.rtc.BeginTextColour((255, 0, 0))
        self.rtc.WriteText("colour, like this red bit.")

It looks like you have to 'build' the contents of the Rich Text Control as you go. When you get to text you want in another (non-default) color, you call BeginTextColour with a tuple that contains the desired RGB (Red, Green, Blue) components. In this case (255,0,0) says use as much red as you can, but no green and no blue. This should end up a 'bright red' color. Once you have output all of the text you want in the selected color, you call EndTextColour() to return to the previous (or default) color. (I'm not sure whether or not wxpython maintains a stack of colors to return to.)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.