Re: [Gimp-developer] Get pointer coordinates in a python script

On 25 January 2014 10:30, Dimitri Robert <dimitri gabian-libre org> wrote:

I need to get pointer coordinates for a Python script but I didn't found the
methode to do that.

Result of my searches :
- no function in the pdb
- need to use PyGTK and gtk.gdk.Event.get_coords but I don't need to create
Event and Window objects, just to found existing.

How to use canvas Window and Event object?

But, maybe am I on a bad path...

That is the keyword for the only existing work-around
The only current way to retrieve user coordinates on an image
from a Python script is to ask the user to draw a Path
(vector) with the paths tool beforehand (or at least,
before pressing the script's "ok" button) and then
use the vectors pdb calls to retrieve those coordinates.

There is no way to retrieve information in an interactive
way - but for a bad hack: letting your plug-in
running and retrieve coordinates from the active paths
by pooling it at each few tenths of a second.

When transitioning to GEGL painting, which
is not scheduled to happen to gimp 2.10 -
maybe it will be possible to use arbitrary GEGL meta-operations
to respond to GIMP events. My idea is that it should be
possible to create such meta-operations from Python
or other language bindings - but this is loong downroad,
and as far as I think, had not been discussed among
the developers in any detail.


Dimitri Robert
Jabber — dimitrirobert jabber fr
Twitter — @DimitriLav
gimp-developer-list mailing list
List address:    gimp-developer-list gnome org
List membership:
List archives:

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]