[wxpython-dev] wxPython access to RichTextCtrl
Petr Šimon
sim at klubko.net
Mon Mar 24 19:16:55 PDT 2008
Robin Dunn wrote:
> Petr Šimon wrote:
>> Hello,
>> I am trying to control export of RichTextCtrl content, by defining
>> named styles and then looping over the nodes in the buffer, export
>> each into HTML that wouldn't be cluttered by too much mark up like
>> font etc. and also to be able to produce HTML that would have <h1>
>> instead of specified font. But I don't seem to be able to get lower
>> that a paragraph.
>>
>> buffer = myrichtextctrl.GetBuffer ()
>> nodes = buffer.GetChildren ()
>> for para in nodes:
>> print para
>>
>>
>> The paragraphs are wx.richtext.RichTextObject. I have also split the
>> paragraph by defining character styles. How do I get to the lower
>> level so I extract character style information?
>>
>> I am doing this as a test so I understand how it works before I try to
>> write proper RichTextFileHandler.
>
> Since SWIG by default creates new proxy objects for returned pointers,
> and doesn't do anything to figure out what is the real type being
> pointed to (it may be of some derived class) then we have to do some
> work ourselves to make it do what is expected. Please try the attached
> patch.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> wxpython-dev mailing list
> wxpython-dev at lists.wxwidgets.org
> http://lists.wxwidgets.org/mailman/listinfo/wxpython-dev
Many thanks, patch works fine.
More information about the wxpython-dev
mailing list