From: Anthony M. Floyd <Anthony.Floyd@co...> - 2007-07-05 16:48:41
> I would like to be able to use matplotlib as an object canvas, where=20
> items on the canvas receive mouse events (enter, leave, press,=20
> release) and the registered callback is invoked.
I do this rather extensively with the wxAgg backend and wxPython
widgets. Which backend/platform are you targeting?
> For example, I want to be able to highlight the line associated with=20
> the legend entry as I mouse over the legend, and conversely highlight=20
> the legend entry associated with the line as I mouse over the line.
> I will also want to do operations such right clicking on the axis to=20
> modify axis properties such as linear/log scale, and click on legend=20
> entries to toggle lines on and off.
These things are all do-able, but my experience has been that I've
needed to modify backend_bases.py, backend_wx.py, and backend_wxagg.py
in order to implement some of my own mouse events (double click, context
click). Further, I capture some wx events and pass them on to my
plotting canvas without using the mpl event system. As long as you
translate the pick locations properly (mpl uses lower left as =
where wx uses upper left) it's not too difficult.
> >From looking at the pick_event_demo in examples, I have a lot of work
> ahead of me. Is this the state of the art?
Yes. Prior to 0.90 there was no pick_event at all, and doing picking
and hit testing was much more complicated. My own code existed pre 0.90
and so I have my own pick routines which work well but might be improved
by updating them to the new picker features. The problem is, of course,
that they work well enough and I've got other fish to fry.
There are quite a number of more experienced and more qualified people
on this list that also do the things you're talking about, but as far as
I know there's no "one way".
Anthony Floyd, PhD
Convergent Manufacturing Technologies Inc.
6190 Agronomy Rd, Suite 403
Vancouver BC V6T 1Z3
Email: Anthony.Floyd@... | Tel: 604-822-9682
WWW: http://www.convergent.ca | Fax: 604-822-9659 =20
CMT is hiring: See http://www.convergent.ca for details
Get latest updates about Open Source Projects, Conferences and News.