#!/usr/bin/env python
import matplotlib
matplotlib.use("WxAgg")
import matplotlib.pyplot as plt


def OnMotion(event):
   print "Contains: ",bool(arrow.contains(event)[0]) 
   
plt.gcf().canvas.mpl_connect('motion_notify_event',OnMotion)

arrowprops = {'arrowstyle': '->',  
              'edgecolor':'blue',
              'facecolor':'red',
              'alpha':0.5,
              'linewidth':2.0,
              "mutation_scale":20.0, 
              'picker':2.0,
              'connectionstyle':"arc3"
              }

arrow = matplotlib.patches.FancyArrowPatch((0.2,0.2),(0.4,0.4),**arrowprops)
plt.gca().add_artist(arrow)

print "PATH for the arrow:"
for i in arrow.get_path().iter_segments():
    print i
    
plt.gca().text(0.5,0.7,"Roll the mouse around to see where the contains box is for the arrow.",ha="center",va="center")
plt.gca().text(0.5,0.6,"There is a large region to the left that claims that it is inside the arrow.",ha="center",va="center")
plt.gca().text(0.5,0.5,"It only happens when there is an arrowhead involved.  Styles -> <- and so forth",ha="center",va="center")

plt.show()