Mouse position values

Steven D'Aprano steve at pearwood.info
Thu Jun 29 02:55:50 EDT 2017


On Wed, 28 Jun 2017 11:32:46 -0300, jorge.conrado wrote:

> Hi,
> 
> I have 3D data array and would like to plot arbitrary cross section by
> cliking in my image. I was an IDL user and in IDL we have a cursor.pro
> that I used to get the X and Y positions on my image. I would like know
> how can I get the values of the X an Y position for two points (A and B)
> in my image and save thiese values.

Unlike some other languages, Python doesn't support getting the mouse 
coordinates directly.

You will have to tell us what version of Python you are using, what 
operating system you are using, and the version of the OS.

If you are using Linux, you probably should tell us what Window Manager 
you have (Gnome, XFCE, KDE, etc...).

Are you using a GUI toolkit, like tkinter, PyQt or similar? If so you 
should tell us.

I'm sorry if this seems complicated, but Python is a language designed to 
operate on hardware where there might not even be a mouse, so it doesn't 
support this function without using an external library, and that will 
depend on your system.



-- 
Steve



More information about the Python-list mailing list