I have loaded an image using Tkinter in Python. It opens up in a python window. If I try to get coordinates of a part of the image, it gives me coordinates relative to the python window that opened up. However, I would like to actually be able to find the client coordinates of that part of the image i.e. coordinates in relation to the actual computer screen.
I looked into using win32gui and somehow trying to get coordinates from the device context, however I could not figure out a way.
Any help is much appreciated!
You can use root.winfo_rootx()
and root.winfo_rooty()
to get the coordinates of the top left corner of the tkinter window. You can add those to the event.x
and event.y
to get the screen coordinates.