[pygtk] Info neded : DrawingArea

A.T.Hofkamp a.t.hofkamp at tue.nl
Mon Jul 13 22:28:31 WST 2009


euro_ii at libero.it wrote:
> Hi Guys,
> I have 3 question.
> 1)
> It's possible to crate custom widgets like 
> edittext inside the drawingArea attached to the mouse pointer so when i move 
> the mouse in the drawingArea the edit text follow the mouse and when i type 
> some keyboar key the values gose directly in to the edit text?

With a lot of programming it should be possible in some way.

> 2)
> It's possible 
> to attach an event like mouse doubleclick at a line created with the .....
> window.draw_line(.  function. ?

yes, connect to the mouse clicks, when receving one, find out which line the 
user clicked on in your data, switch the colour of that line (and switch all 
other lines back to their original colour), mark the area of all changed lines 
as dirty, so the system will redraw that part of the canvas.

> 3)
> It's possible to make a sort of highlight on 
> the entity in the DrawingArea so when i move the mouse over the  line the line 
> change the color?

yes, connect to mouse tracking, when a coordinate comes near a line (which you 
can find in your data), switch the colour of the line, and mark it as dirty so 
the system will redraw it.
when the coordinate moves away from the line, switch the color back, and mark 
it as dirty again so the system will redraw the line in original colour.


The DrawingArea is just like a piece of paper. It has no idea what you draw on 
it, and it doesn't keep record.
If you want to have nice interactive effects, you will have to program yourself.

Sincerely,
Albert


More information about the pygtk mailing list