RSS/Atom feed Twitter
Site is read-only, email is disabled

Get pointer coordinates in a python script

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

5 of 5 messages available
Toggle history

Please log in to manage your subscriptions.

Get pointer coordinates in a python script Dimitri Robert 25 Jan 12:30
  Get pointer coordinates in a python script Joao S. O. Bueno 25 Jan 23:48
   Get pointer coordinates in a python script Daniel Sabo 26 Jan 02:47
    Get pointer coordinates in a python script Joao S. O. Bueno 27 Jan 02:07
     Get pointer coordinates in a python script Daniel Sabo 27 Jan 03:07
Dimitri Robert
2014-01-25 12:30:30 UTC (about 10 years ago)

Get pointer coordinates in a python script

Hi,

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...

Dimitri Robert
Jabber  dimitrirobert@jabber.fr
Twitter  @DimitriLav
Joao S. O. Bueno
2014-01-25 23:48:56 UTC (about 10 years ago)

Get pointer coordinates in a python script

On 25 January 2014 10:30, Dimitri Robert wrote:

Hi,

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?

f

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

That is the keyword for the only existing work-around "path".
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.

js ->

--
Dimitri Robert
Jabber — dimitrirobert@jabber.fr
Twitter — @DimitriLav
_______________________________________________ gimp-developer-list mailing list
List address: gimp-developer-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list List archives: https://mail.gnome.org/archives/gimp-developer-list

Daniel Sabo
2014-01-26 02:47:04 UTC (about 10 years ago)

Get pointer coordinates in a python script

All painting is GEGL based in 2.10; I don't think there is any plan to allow arbitrary ops for painting. You can't retrieve coordinates is because plugins run in their own process and can't access Gimp's event loop or windows. It would be hypothetically possible for Gimp to pump events across to the plugin process, but my understand is that preventing plugins from interacting with Gimp's GUI was an intentional design decision.

Joao S. O. Bueno
2014-01-27 02:07:36 UTC (about 10 years ago)

Get pointer coordinates in a python script

All painting is done in a GEGL Buffer - but the events got from the user don't traverse a GEGL interface into GEGL nodes which paint on these buffers: I think it should not be to hard to think of a way (I am not saying about it would not be hard to implement - I am saying it would not be hard to think about it) - of getting the events processed in GIMP, have the parts which does the dynamics in a separate logic layer, in a way one could get the processed events in an arbitrary GEGL node - the events would simply be an input.

That way, the modular design of GEGL could be used to create modular tools into GIMP.

js -> wrote:

All painting is GEGL based in 2.10; I don't think there is any plan to allow arbitrary ops for painting. You can't retrieve coordinates is because plugins run in their own process and can't access Gimp's event loop or windows. It would be hypothetically possible for Gimp to pump events across to the plugin process, but my understand is that preventing plugins from interacting with Gimp's GUI was an intentional design decision.

Daniel Sabo
2014-01-27 03:07:13 UTC (about 10 years ago)

Get pointer coordinates in a python script

The evil "Use GimpApplicator" checkbox on the paint tools will cause them to render with a gegl graph that replicates the painting functions (evil because it's slow). I do think we should have pluggable tools in gimp, and using a graph editor to build tools would also be cool. But I don't think they will be performant enough for anything but very special effects. So I would much rather aim for having tools plug at a higher level instead of constraining them to "node based".