detect mouse clicks

For my application which is a simple sound file editor written with matplotlib and PyQt4, I want to detect left and right clicks on the canvas. I need to know the data coordinates of the click (i.e., not where on the screen the click occurred, but what data point as defined by the axes it represents). How do I do this?

Mike

Note: I’m looking at the Picker examples now and one problem I see is that I’m not asking the user to click on data points, but anywhere on the axes.

···

On Mon, Apr 21, 2014 at 3:49 PM, Michael Mossey <michaelmossey@…1003…7…> wrote:

For my application which is a simple sound file editor written with matplotlib and PyQt4, I want to detect left and right clicks on the canvas. I need to know the data coordinates of the click (i.e., not where on the screen the click occurred, but what data point as defined by the axes it represents). How do I do this?

Mike

Further update: I think I know how to do this. I can register a mouse event handler, and its xdata and ydata properties will tell me the data coordinates.

···

On Mon, Apr 21, 2014 at 4:17 PM, Michael Mossey <michaelmossey@…1003…7…> wrote:

Note: I’m looking at the Picker examples now and one problem I see is that I’m not asking the user to click on data points, but anywhere on the axes.

On Mon, Apr 21, 2014 at 3:49 PM, Michael Mossey <michaelmossey@…1003…7…> wrote:

For my application which is a simple sound file editor written with matplotlib and PyQt4, I want to detect left and right clicks on the canvas. I need to know the data coordinates of the click (i.e., not where on the screen the click occurred, but what data point as defined by the axes it represents). How do I do this?

Mike