Hello,
I have some some matplotlib code that we use for interactive plotting, and I
want to do non-interactive unit testing. This means I need to emulate
keypresses and mouse clicks.
It is simple enough to do keypress unit testing by using:
fig.canvas.key_press_event('down')
This for example allows us to test that pressing "down" in a figure window
elicits the appropriate behavior.
However, I am having difficulty testing mouse clicks. We have behaviors
where users can click within an axis (e.g., fix.axes[1]) to elicit some
behavior. I have tried the following:
fig.canvas.button_press_event(0.5, 0.5, 1)
But within the event handler (which generally has structure
_mouse_click(event, params)), the "event" object does not have the
"event.inaxes" field populated correctly (it is always "None") despite my
emulated click @ (0.5, 0.5) sitting within one of the axes in the figure.
Does anyone know how to emulate either of these types of clicks?
···
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Emulating-keypress-and-mouse-clicks-tp42534.html
Sent from the matplotlib - users mailing list archive at Nabble.com.