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!
Steve

Recommended Answers

All 2 Replies

This didn't make any sense?

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

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.)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.