Wednesday, 15 April 2015

python - Matplotlib Pick Event Functionality -


This is really a strange gesture where a pick event is removed if you "scroll" while the mouse cursor Is the artist's object of interest kept, is this expected behavior? To illustrate, I am using a Macbook, and by scrolling I mean two finger swipe (or a finger on the magic mouse).

The functionality I am trying to achieve is Tooltips Segment (Polygon Art Objects Objects) on some specific tools, and if you click, the event works, but whenever you scroll , While the mouse remains in the interest of a segment, then many select events are removed.

I can not find anything online where people have to face the same problem, and the doctor is not clear on the firing of a pickup event (It just says: "When the artist canvas the user But raises a place sufficiently close to an artist's place "). Is "pickup" formed?

Edit: An example of what I'm doing (these functions are part of a wxpython panel subclass)

  DIF plot (self)): in range (LAN (startup): Latex xxspace (start time [i], endtimes [i], color = 'blue', alpha = 0.3, picker = true)) Mpl_connect ('pick_event', self.onpick3) def onpick3 (auto, event): x = event.mouseevent.xdata y = for event.mouseevent.ydata range (lane (starttimes)): if x & lt; Endats [i] and x & gt; StartTimes [i]: Print section labels [i]  

Now you can solve it But the scroll wheel for the reference is registered as a button, which is actually the expected functionality.

The solution to your problem above is to filter the event using MouseEvent's button property:

  def onpick3 (auto, event): If event.mouseevent.button = = 1 # - & gt; Left-click only x = event.mouseevent.xdata y = event.mouseevent.ydata in range for (lane (starttimes): if x  

Documents found here:

User chooses when a pick event is removed A mouse event is close to an artist close enough to the canvas (see link above)

For latitude picker etter, 'adequate close' can be controlled to pass an integer as tolerance. , So "picker = true" can be upwards, "picker = 5".


No comments:

Post a Comment