|
From: Christopher B. <Chr...@no...> - 2006-02-06 20:53:32
|
Andrea Gavana wrote:
> I have checked wxmpl, but it seems to me that it has the same mouse events
> as matplotlib has (button down/up/motion) and nothing more.
wxmpl provides a subclass of wxPanel, so it's there somewhere. I haven't
done mouse events, so I I don't know where yet. I do think wxmpl could
use some more work.
> matplotlib and wxmpl fail to get the mouse_down event if you click very fast
> on the figure canvas.
I'm guessing that what's happening is that the two mouse clicks close
together are getting caught as a double-click, so the second one doesn't
show up as a single click.
> So I ended up in a dirty
> hack of a MPL single mouse_down to transform it in a double-click,
ugh. I'd poke around more in the wxmpl code. Maybe I'll do that myself.
OK-- I started doing that, but first I just tried binding a event to a
wxmpl.PlotPanel, and it works fine. I've enclosed a little sample. It
should write to the console when you left, right or double-left click on
the PlotPanel.
Note that when you double click, you get one left click event and one
double click event, but not two left click events.
Of course, you'll now need to figure out how to query the FigureCanvas
to see what the axes coords are, but I'm sure you can find code on MPL
that will give you hints.
By the way, you could hack backend_wx.py to add the double click events,
but that would be ugly if it wasn't added everywhere else in MPL --
which is kind of why I think that way lies madness ;-)
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
|