Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mouse position
#1
Hi All,
I am new to python
How to get mouse position after click

Example

I clicked on the screen , outuput should show x and y cordinates where i clciked on the screen


Thanks
Reply
#2
For what OS? This might be helpful.
Reply
#3
Depends largely on the GUI you are using. If wx, then the wx.MouseEvent and wx.MouseState would be helpful. I don't use Tkinter but a quick google search suggests winfo_pointerx() and winfo_pointery(). If pyautogui then apparently pyautogui.position() returns the x and y positions
Reply
#4
A lot more information is required. What kind of application are you trying to write; console application, GUI application, game, other?

Why do you need the mouse position?

What have you tried so far to get the mouse position? Of the things you've tried, how are they not working? Do they have an error that prevents them from running? Do they have an error that causes them to crash? Do they run but not provide the mouse position?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Photo i want to locate an image according to the mouse position rachidel07 1 2,787 Feb-08-2021, 03:29 PM
Last Post: michael1789
  Read mouse position on separate between two HDMIs ATARI_LIVE 1 1,383 Sep-28-2020, 07:48 PM
Last Post: ATARI_LIVE
  Move mouse and click in particular position biprabu 3 2,441 Sep-01-2020, 08:23 PM
Last Post: deanhystad
  mouse 0.7.0 - mouse polling hate 125-1000hz penahuse 1 2,466 Dec-06-2019, 09:51 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020