0

I am currently developing an app to take specialized screenshots for work using Python and Tkinter. While I have already implemented a click-and-drag process for a screenshot, I want to add another way to take a screenshot by simply clicking on an open app window, such as a browser, and get its coordinates and use those for a screenshot.

My problem is that I cannot find a way to get a window's coordinates with a mouse click in Python. Is this even possible?

I have not been able to find a way to even try what I want but the functionality of the Windows Snipping Tool (window mode) is what I'm trying to replicate.

Mi5trB
  • 17
  • 3
  • 1
    @MattDMo OP does not want the position of the mouse click. OP wants to get the position and size of the window under the mouse click. – acw1668 May 03 '23 at 16:34
  • @acw1668 you're right, the problem statement wasn't worded very clearly. Dupe revoked. – MattDMo May 03 '23 at 16:38
  • 1
    You can use [PyAutoGUI](https://pyautogui.readthedocs.io/en/latest/) to get the coordinates of a click, [PyGetWindow](https://pygetwindow.readthedocs.io/en/latest/) to get the coordinates of a window. – ken May 03 '23 at 16:59
  • Looks like some good info in this link: https://stackoverflow.com/questions/3260559/how-to-get-a-window-or-fullscreen-screenshot-without-pil – Pragmatic_Lee May 03 '23 at 17:05
  • Does this answer your question? [Get window position & size with python](https://stackoverflow.com/questions/7142342/get-window-position-size-with-python) – relent95 May 08 '23 at 05:42

0 Answers0