Changing Font Colour Of Styledtextctrl
I am trying to change the default font colour of the following StyledTextCtrl, I've been testing this for awhile and changing the hex code values however I can't seem to get it to
Solution 1:
self.StyleSetForeground(wx.stc.STC_STYLE_DEFAULT,wx.Colour(230, 230, 250))
will only change the colour of the default style.
Your code uses many different styles, each with their own colour specified. Notice the "fore" argument in the following code:
self.StyleSetSpec(stc.STC_P_COMMENTLINE,
"fore:#007F00,face:%(other)s,size:%(size)d" % faces)
It seems like your line numbers are using the default style and all the other text is using their own style. I don't understand where the styles are being set so I can't explain is why the line numbers don't use wx.stc.STC_STYLE_LINENUMBER
.
So, either remove the self.StlyeSetSpec()
calls or include your self.StyleSetForeground()
call at the end of the initializer (and don't forget to call self.StyleClearAll()
to reset all the text to the default style).
Post a Comment for "Changing Font Colour Of Styledtextctrl"