[pygtk] Text widget that allows for adding annotations

Gendag gendag at gmail.com
Mon Jun 9 05:29:35 WST 2008


Samuel Abels ha scritto:
> Hi,
> 
> I am looking for a hopefully painless way to create a text widget that
> supports annotations similar to the ones found on this picture:
> 
> http://words.ibritt.com/images/loremIpsumSampleDoc.gif
> 
> Before implementing my own solution that pushes a Gtk.TextView into a
> canvas, any ideas how to do that more easily?

Hi,
I'm trying to create annotations into a TextView too. I found very 
useful the  example found here: 
http://www.pygtk.org/pygtk2tutorial/sec-TextViewExample.html

You can download the program and see how the red rectangles "drag me 
around" are implemented. In shorts: the red rectangles are simple Labels 
  but you can substitute them with another TextView to implement 
writable annotations. Then you have to manage the dragging and mouvement 
of the annotations inside the TextView. In the example the Label (which 
cannot receive signals) are wrapped inside an EventBox who can receive 
and manage the button pressed/released and mouvement signals.

If you have other questions or you find a better way, you are welcome.

I'm still trying to find a way to draw the arrows from the annotations 
to the text but I didn't find anything, now I'm still focused to manage 
correctly the events of the annotations.

bye,

Gendag



More information about the pygtk mailing list