wxpython RichTextCtrl. How to set a background color to a text selection -
For example, it is bold Weight:
rtc.ApplyBoldToSelection () < / Code> I am trying to highlight feature highlights in an editor. to
There does not appear to be a convient way it is, but looking wxPython demo RichTextCtrl From I came with the following:
attr = wx.TextAttr () attr.SetFlags (Wx.TEXT_ATTR_TEXT_COLOUR) r = rtc.GetSelectionRange () attr.SetFlags (wx.TEXT_ATTR_TEXT_COLOUR) attr.SetBackgroundColour (color) rtc.SetStyle ( R, attr) You probably want to put it in a method and you can use it again.
Comments
Post a Comment