[pygtk] Fwd: Re: TextBuffer to Markup
Smartboy
smartboyathome at gmail.com
Thu Feb 17 01:15:15 WST 2011
(whoops, sorry for the duplicate bradlee, but this didn't get sent to
the list. also forgot to include the url)
https://github.com/smartboyathome/SmartTE/raw/master/SmartTE.py
On 02/16/2011 09:05 AM, Bradlee Landis wrote:
> Is there an easy way to convert from a TextBuffer to the Pango Markup
> Language? I can't seem to find it, even though it seems like it would
> be a desired feature by at least a few people.
>
> I need to save the data inside an XML document, with formatting
> intact, and so I was just going to use the Pango Markup Language to
> store it. I would accept other suggestions though.
>
How have you been applying the formatting, using gtk.TextTags? I have a
project on github called SmartTE (a rich text editor along the same vein
as wordpad) which is already starting to age in terms of my skill, but
the functions textConvertTo and textConvertFrom should give you an
example of how you can save and restore formatting from a file. You can
use this code if it will help you for your project, just be sure to note
my license (it is a custom BSD). If you have any questions, feel free to
ask, I should be able to reply within a timely manner of less than one day.
Smartboy
More information about the pygtk
mailing list