I think the OP's desire is to have pick events fire after the zoom has been
triggered.

Currently, after you zoom (or pan), the zoom tool is still active until you
click it again.  Pick events won't fire while the zoom tool is the selected
tool, and you have to manually de-select it (i.e. click the zoom button
again for pick events to work).

The current behavior is the right default choice, i.m.o., but it's
counter-intuitive when combined with pick events.

When you're building a gui to interact with data (or, for example, when
using mpldatacursor -- this is a question I get a lot), a common
expectation is that after you zoom once, the zoom tool is no longer
active.  Pick events should work again.

Currently, you have to subclass (or monkey-patch) the toolbar to make this
happen.  It's a bit of a pain.  (It's more complicated that just setting
`fig.canvas.toolbar._active`.)  (If I'm wrong about that, please let me
know!!!)

It would be nice to have an easier way to "deactivate" the zoom/pan tool.
I think the "new" toolbar might have that, but I haven't checked.

Cheers,
-Joe


On Thu, Aug 21, 2014 at 1:41 PM, Benjamin Root <ben.r...@ou.edu> wrote:

> Imagine someone creates some event that would modify an artist upon
> picking, or do some expensive calculation, or some other action. But, I
> seriously doubt anybody would want those actions to fire while using the
> zoom/pan tool. Especially since the mouse cursor looks totally different. I
> am curious why you would expect pick events to fire while using pan/zoom.
> What is the user-story that compels that expectation? Perhaps I could be
> convinced otherwise to offer some sort of toggle.
>
>
>
> On Thu, Aug 21, 2014 at 2:33 PM, Michael Kaufman <kaufma...@ornl.gov>
> wrote:
>
>> What kind of bad stuff happens if we were to allow that?
>>
>> M
>>
>>
>> On 8/21/14 2:29 PM, Benjamin Root wrote:
>>
>>> Yes, those tools do "snarf" up pick events via the widgetlock mechanism,
>>> IIRC. This is entirely intentional, and I an not sure there is a bug
>>> here to fix.
>>>
>>>
>>> On Thu, Aug 21, 2014 at 12:01 PM, Thomas Caswell <tcasw...@gmail.com
>>> <mailto:tcasw...@gmail.com>> wrote:
>>>
>>>     On Thu, Aug 21, 2014 at 9:44 AM, Michael Kaufman <kaufma...@ornl.gov
>>>     <mailto:kaufma...@ornl.gov>> wrote:
>>>      >
>>>      >    # plot axvlines here... etc.
>>>      >
>>>      >    global cids
>>>      >
>>>      >    # remove any previous connections
>>>      >    for i in cids:
>>>      >       gcf().canvas.mpl_disconnect(i)
>>>      >    cids = []
>>>      >
>>>      >    cids.append(gcf().canvas.mpl_connect('pick_event',self.pick))
>>>      >
>>>     cids.append(gcf().canvas.mpl_connect('button_press_event',
>>> self.click))
>>>      >
>>>      >    draw()
>>>      >
>>>      > def pick(self, event):
>>>      >    thisline = event.artist
>>>      >    xdata, ydata = thisline.get_data()
>>>      >    print xdata[0]
>>>      >
>>>      > def click(self, event):
>>>      >    print "clicked"
>>>
>>>
>>>     See this minimal example
>>>
>>>     ```
>>>     import matplotlib.pyplot as plt
>>>     fig, ax = plt.subplots()
>>>
>>>     ax.axvline(.5, picker=6)
>>>     ax.plot(range(3))
>>>     cids = []
>>>
>>>     plt.draw()
>>>
>>>     def pick(event):
>>>         thisline = event.artist
>>>         xdata, ydata = thisline.get_data()
>>>         print xdata[0]
>>>
>>>     def click(event):
>>>         print "clicked"
>>>
>>>
>>>     cids.append(fig.canvas.mpl_connect('pick_event', pick))
>>>     cids.append(fig.canvas.mpl_connect('button_press_event', click))
>>>
>>>     ```
>>>
>>>     If you turn the zoom/pan tool off the picker works again.  I suspect
>>>     that there is some logic underneath those tools that are snarfing
>>>     events when the are turned on to avoid messy conflicts.  There is
>>> some
>>>     work going on (MEP22 iirc) to update the toolbar and make our tool
>>>     handling saner.
>>>
>>>     Tom
>>>     --
>>>     Thomas Caswell
>>>     tcasw...@gmail.com <mailto:tcasw...@gmail.com>
>>>
>>>
>>>     ------------------------------------------------------------
>>> ------------------
>>>     Slashdot TV.
>>>     Video for Nerds.  Stuff that matters.
>>>     http://tv.slashdot.org/
>>>     _______________________________________________
>>>     Matplotlib-users mailing list
>>>     Matplotlib-users@lists.sourceforge.net
>>>     <mailto:Matplotlib-users@lists.sourceforge.net>
>>>     https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>>
>>
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to