Getting a RichTextCtrl's default font size in wxPython

Posted by Sam on Stack Overflow See other posts from Stack Overflow or by Sam
Published on 2010-05-01T23:39:23Z Indexed on 2010/05/01 23:47 UTC
Read the original article Hit count: 412

Filed under:
|
|

I have a RichTextCtrl, which I've modified to accept HTML input. The HTML parsing code needs to be able to increase and decrease the font size as it gets tags like <font size="-1">, but I can't work out how to get the control's default font size to adjust.
I tried the following (where self is my RichTextCtrl):

fred = wx.richtext.RichTextAttr()
self.GetStyle(0,fred)
print fred.GetFontSize()

However, the final instruction fails, because GetStyle turns fred into a TextAttrEx and so I get AttributeError: 'TextAttrEx' object has no attribute 'GetFontSize'. Am I missing a vastly easier way of getting the default font size?

© Stack Overflow or respective owner

Related posts about wxpython

Related posts about wxwidgets