I'm working on GUI apps using matplotlib's class library with
both WXAgg and TkAgg backends, and am having a love/hate
relationship with the FigureCanvase.mpl_connect() methods.
These return a platform-neutral, matplotlib-aware Event, which
is great for dealing with the Plot canvas, but swallow the
native GUI event, complicating working with the GUI toolkit.
It seems simple enough to include the native event structure as
a member of the the mpl event. That would allow the
backend-specific code to use these backend-specific events. I
think this could be as simple as adding an optional keyword arg
'gui_event' to KeyEvent.__init__, LocationEvent.__init__, and
MouseEvent._init__, and then passing along the native event
objects in the backends. That would simply add a GUI-specific
attribute 'gui_event' to the mpl event, breaking no existing
code or the functionality of the Toolbars, but allow those of us
who want more event information to have it.
Does this change seem reasonable? It would involve many small
changes in backend_bases.py and backends/backend*.py. I'd be
willing to implement it, but am reluctant to step on anyone
else's toes, especially for the different backends....
--Matt Newville <newville @ cars.uchicago.edu>