logo       

Re: Basic Text Editing (adding pangolayout to a buffer + copy/paste control: msg#00110

gnome.gtk+.python

Subject: Re: Basic Text Editing (adding pangolayout to a buffer + copy/paste controls)

On Mon, 14 Feb 2005 21:21:55 -0500, Thomas Mills Hinkle
<tmhinkle@xxxxxxxxx> wrote:
> Second, I understand that according to the following bug, inserting
> pango markup (<u>,<b> etc.) into text-buffers is not easily supported
> in gtk (though perhaps coming soon)...
>
> http://bugzilla.gnome.org/show_bug.cgi?id=59390
>
> However, I'd like to do this. Actually, I'd like to allow my users to
> do basic formatting with "italic"/"bold"/"underline" buttons. I'd then
> like to preserve that formatting as pango to pass to e.g. gnomeprint
> to be layed out with pangolayout.
>
> Has anyone already done something like this in pygtk? I'm guessing
> that if I sit down and implement this, I'll be needless duplicating
> code that's already written somewhere -- can anyone confirm my
> suspicion by pointing me to an example? Thanks in advance...

Well, since I didn't get a good example to use (except for mozembed,
which for my purposes, was overkill), I cooked one up.

Here it is for anyone else following this thread. This implements
basic italic/bold/underline, etc., and provides get_text and set_text
methods that allow you to get pango markup out of a TextBuffer.

Tom

Attachment: TextBufferMarkup.py
Description: Text Data

_______________________________________________
pygtk mailing list pygtk@xxxxxxxxxx
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise