Hi,
I am trying to retrieve the character style of a piece of RichText. I have a RichTextCtrl object 'rtc' and use the following code:
import wx.richtext as rc
I get the following eroor:
AttributeError: 'TextAttrEx' object has no attribute 'GetFontFaceName'
For some reason oldStyle is an TextAttrEx object instead of RichTextAttr. Does anyone have a clue what I am doing wrong here?
RichTextAttr is just a compatibility alias for TextAttrEx. Everything in the python wrappers for RichTextCtrl switched to using just TextAttrEx a couple releases ago. (The C++ code has overloads for both of them for most functions, I just chose to support one for the wrappers to save a bunch of hassle.)
Try style.GetFont().GetFaceName() instead.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
AttributeError: ‘TextAttrEx’ object has no attribute ‘GetFontFaceName’
For some reason oldStyle is an TextAttrEx object instead
of RichTextAttr. Does anyone have a clue what I am doing wrong here?
RichTextAttr is just a compatibility alias for TextAttrEx. Everything
in the python wrappers for RichTextCtrl switched to using just
TextAttrEx a couple releases ago. (The C++ code has overloads for both
of them for most functions, I just chose to support one for the wrappers
to save a bunch of hassle.)
Try style.GetFont().GetFaceName() instead.
–
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!