[pygtk] Re: THANKS a lot!!!

Johan Dahlin jdahlin at async.com.br
Thu Feb 16 20:21:07 WST 2006


> my main objective was to use mouse events to move the ellipse mainly by 
> clicking and dragging the mouse on the ellipse hence moving it across 
> the window in any direction(some initial code of the same is there on 
> the mailing list). The only way to do the same was by refering to the 
> drag and drop example in the tutorial, but that uses a pixmap rather 
> than a vector drawing.

Seems like you're trying to write a canvas.
I'd recommend looking at other solutions first, there are a couple of 
ongoing efforts to write a canvas on top of cairo.

You don't actually need to do drag and drop.
There's some code to handle the logic of moving windows inside windows
in some code Havoc Pennington wrote (and I extended) inside gazpacho:

http://svn.sicem.biz/gazpacho/trunk/gazpacho/workspace.py

Methods of interest to you are:

_begin_move_child
_update_move_child
_end_move_child
do_button_press_event
do_button_release_event
do_motion_notify_event

It handles the mouse logic for resize and move, you'd still have
to adapt/implement the actual drawing to use cairo and your data structures.

Good luck

-- 
Johan Dahlin <jdahlin at async.com.br>
Async Open Source


More information about the pygtk mailing list