2010-05-01 2 views
0

나는 HTML 입력을 허용하도록 수정 한 RichTextCtrl을 가지고 있습니다. HTML 구문 분석 코드는 <font size="-1">과 같은 태그를 가져올 때 글꼴 크기를 늘리거나 줄일 수 있어야하지만 컨트롤의 기본 글꼴 크기를 조정하는 방법을 알아낼 수 없습니다.
나는 시도 다음 (self이 어디 내 RichTextCtrl) : wxPython에서 RichTextCtrl의 기본 글꼴 크기 가져 오기

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

그러나, 최종 명령이 실패 및 getStyle는 TextAttrExfred을 전환 때문에 내가 AttributeError: 'TextAttrEx' object has no attribute 'GetFontSize'를 얻을. 나는 기본 글꼴 크기를 얻는 훨씬 더 쉬운 방법을 놓치고 있습니까?

답변

0

해결했습니다. 컨트롤에 데이터가 쓰여지기 전에 :

self.defaultstyle = wx.richtext.RichTextAttr() 
self.GetStyle(self.GetInsertionPoint(), self.defaultstyle) 
self.defaultsize = self.defaultstyle.GetFont().GetPointSize()