I'd really like to be able to ask my program "where is the mouse pointer?" at any given time.

Ideally I'll want people to click and hold a button, which will cause a stream of events to occur, and then (at varying points) the program should find out where their mouse pointer is (while they are still holding down the button).

Is this possible? I've looked into the Canvas widget and feel that the answer must be there, but haven't been able to find it.

Recommended Answers

All 4 Replies

Refer to this post

Ahh, thanks!

I was hoping to incorporate this functionality into Tkinter though. Is this possible too?

Looks like you can do that according to this post

Ahh, also, his code only collects the mouse coordinates on a button click. I need to be able to query for them WHILE the person is holding down a button -- so the program has to be able to do it on its own.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.